Skip to content

Commit

Permalink
Merge pull request #173 from devhindo/lint
Browse files Browse the repository at this point in the history
Update GitHub Actions workflows to use setup-go@v5 and golangci-lint-action@v6; refactor error formatting and import statements
  • Loading branch information
leecalcote authored Dec 30, 2024
2 parents 9a4f3b1 + d542f64 commit 2777ee5
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: GOPROXY=direct GOSUMDB=off GO111MODULE=on go build .
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
name: Check & Review code
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
with:
go-version: 1.23
- uses: actions/checkout@master
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v6
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.54
version: v1.62

# Optional: working directory, useful for monorepos
# working-directory: somedir
Expand All @@ -40,7 +40,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go install github.com/kisielk/errcheck@latest; /home/runner/go/bin/errcheck -tags draft ./...
Expand All @@ -53,7 +53,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: |
Expand All @@ -75,13 +75,13 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- uses: dominikh/staticcheck-action@v1.2.0
- uses: dominikh/staticcheck-action@v1.3.0
with:
version: "latest"
install-go: false
version: "2022.1"
vet:
name: Vet
runs-on: ubuntu-latest
Expand All @@ -91,7 +91,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- run: GOPROXY=https://proxy.golang.org,direct GOSUMDB=off GO111MODULE=on go vet -tags draft ./...
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
with:
fetch-depth: 1
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Create cluster using KinD
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/component-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
token: ${{ secrets.GH_ACCESS_TOKEN }}
ref: "master"
- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Run adapter to create components
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/error-ref-publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
ref: 'master'

- name: Setup Go
uses: actions/setup-go@v4
uses: actions/setup-go@v5
with:
go-version: 1.23

Expand Down
2 changes: 1 addition & 1 deletion cilium/cilium.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import (
"github.com/layer5io/meshkit/errors"
"github.com/layer5io/meshkit/logger"
"github.com/layer5io/meshkit/models"
"github.com/layer5io/meshkit/utils"
"github.com/layer5io/meshkit/models/oam/core/v1alpha1"
"github.com/layer5io/meshkit/utils"
"github.com/layer5io/meshkit/utils/events"
"gopkg.in/yaml.v2"
)
Expand Down
2 changes: 1 addition & 1 deletion cilium/oam.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func mergeErrors(errs []error) error {
errMsgs = append(errMsgs, err.Error())
}

return fmt.Errorf(strings.Join(errMsgs, "\n"))
return fmt.Errorf("%s", strings.Join(errMsgs, "\n"))
}

func mergeMsgs(strs []string) string {
Expand Down
9 changes: 6 additions & 3 deletions cilium/oam/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@ var (
//WorkloadPath will be used by both static and component generation
WorkloadPath = filepath.Join(basePath, "templates", "oam", "workloads")
MeshmodelComponents = filepath.Join(basePath, "templates", "meshmodel", "components")
traitPath = filepath.Join(basePath, "templates", "oam", "traits")
basePath, _ = os.Getwd()
// traitPath = filepath.Join(basePath, "templates", "oam", "traits") <= unused variable
basePath, _ = os.Getwd()
)

// AvailableVersions denote the component versions available statically
var AvailableVersions = map[string]bool{}
var availableVersionGlobalMutex sync.Mutex

// unused type
/*
type schemaDefinitionPathSet struct {
oamDefinitionPath string
jsonSchemaPath string
name string
}
*/

type meshmodelDefinitionPathSet struct {
meshmodelDefinitionPath string
Expand Down Expand Up @@ -77,4 +80,4 @@ func loadMeshmodelComponents(basepath string) ([]meshmodelDefinitionPathSet, err
}

return res, nil
}
}
6 changes: 1 addition & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func init() {
func main() {
// Initialize Logger instance
log, err := logger.New(serviceName, logger.Options{
Format: logger.SyslogLogFormat,
Format: logger.SyslogLogFormat,
})
if err != nil {
fmt.Println(err)
Expand Down Expand Up @@ -120,10 +120,6 @@ func main() {
}
}

func isDebug() bool {
return os.Getenv("DEBUG") == "true"
}

func mesheryServerAddress() string {
meshReg := os.Getenv("MESHERY_SERVER")

Expand Down

0 comments on commit 2777ee5

Please sign in to comment.