Skip to content

Commit

Permalink
Update go.fd.io/govpp and bump go version
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Glazychev <artem.glazychev@xored.com>
  • Loading branch information
glazychev-art committed Jan 12, 2024
1 parent a14aece commit 39e7cb5
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 222 deletions.
67 changes: 11 additions & 56 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,63 +7,18 @@ on:
pull_request:
jobs:
yamllint:
name: yamllint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: yaml-lint
uses: ibiqlik/action-yamllint@v1
with:
config_file: .ci/yamllint.yml
strict: true
build:
name: build and test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v1
with:
go-version: 1.13.4
- name: Build
run: go build -race ./...
uses: networkservicemesh/.github/.github/workflows/yamllint.yaml@main

build-and-test:
uses: networkservicemesh/.github/.github/workflows/build-and-test.yaml@main
with:
os: '["ubuntu-latest", "macos-latest", "windows-latest"]'

golangci-lint:
name: golangci-lint
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: v1.52.2
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main

checkgomod:
name: check go.mod and go.sum
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13.4
- run: go mod tidy
- name: Check for changes in go.mod or go.sum
run: |
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false )
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false )
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main

excludereplace:
name: Exclude Replace in go.mod
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Exclude replace in go.mod
run: |
grep ^replace go.mod || exit 0
exit 1
exclude-replace:
uses: networkservicemesh/.github/.github/workflows/exclude-replace.yaml@main
21 changes: 8 additions & 13 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ linters-settings:
goheader:
template-path: ".ci/license/template.txt"
values:
const:
year: 2020
regexp:
year-range: ((\d\d\d\d-{{year}})|({{year}}))
company: .*
copyright-holder: Copyright \(c\) {{year-range}} {{company}}\n\n
copyright-holder: Copyright \(c\) ({{year-range}}) {{company}}\n\n
copyright-holders: ({{copyright-holder}})+
errcheck:
check-type-assertions: false
Expand All @@ -36,19 +33,17 @@ linters-settings:
dupl:
threshold: 150
funlen:
Lines: 100
Statements: 50
lines: 100
statements: 50
goconst:
min-len: 2
min-occurrences: 2
depguard:
list-type: blacklist
include-go-root: false
packages:
- errors
packages-with-error-message:
# specify an error message to output when a blacklisted package is used
- errors: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
rules:
main:
deny:
- pkg: "errors"
desc: "Please use \"github.com/pkg/errors\" instead of \"errors\" in go imports"
misspell:
locale: US
unparam:
Expand Down
18 changes: 15 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
module github.com/networkservicemesh/vpphelper

go 1.15
go 1.20

require (
github.com/edwarnicke/exechelper v1.0.2
github.com/edwarnicke/log v1.0.0
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.0
go.fd.io/govpp v0.8.0
github.com/stretchr/testify v1.8.4
go.fd.io/govpp v0.10.0-alpha.0.20240110141843-761adec77524
gopkg.in/fsnotify.v1 v1.4.7
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lunixbochs/struc v0.0.0-20200521075829-a4cb8d33dbbe // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
golang.org/x/sys v0.13.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
163 changes: 19 additions & 144 deletions go.sum

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions start.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -20,7 +20,6 @@ package vpphelper

import (
"context"
"io/ioutil"
"os"
"path"
"path/filepath"
Expand Down Expand Up @@ -86,7 +85,7 @@ func writeDefaultConfigFiles(ctx context.Context, o *option) error {
if err := os.MkdirAll(path.Dir(filename), 0o700); err != nil {
return err
}
if err := ioutil.WriteFile(filename, []byte(contents), 0o600); err != nil {
if err := os.WriteFile(filename, []byte(contents), 0o600); err != nil {
return err
}
}
Expand Down
18 changes: 18 additions & 0 deletions tools.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package vpphelper

import (
"strings"
"text/template"
)

// VPPConfigParameters - custom parameters used by VPP config
type VPPConfigParameters struct {
DataSize int
RootDir string
}

// NewVPPConfigFile creates new VPP config based on parameters
func NewVPPConfigFile(configTemplate string, params VPPConfigParameters) string {
vppConfigBuilder := new(strings.Builder)

Expand Down
19 changes: 18 additions & 1 deletion tools_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
// Copyright (c) 2023-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package vpphelper_test

import (
"testing"

"github.com/networkservicemesh/vpphelper"
"github.com/stretchr/testify/require"
"testing"
)

const (
Expand Down
6 changes: 4 additions & 2 deletions vpp.conf.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020 Cisco and/or its affiliates.
// Copyright (c) 2020-2024 Cisco and/or its affiliates.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand All @@ -17,7 +17,9 @@
package vpphelper

const (
vppConfFilename = "/etc/vpp/helper/vpp.conf"
vppConfFilename = "/etc/vpp/helper/vpp.conf"

// DefaultVPPConfTemplate - template for VPP config
DefaultVPPConfTemplate = `unix {
nodaemon
log {{ .RootDir }}/var/log/vpp/vpp.log
Expand Down

0 comments on commit 39e7cb5

Please sign in to comment.