From dae0793c1cd5715a5ee9915bbee685e70946c9d0 Mon Sep 17 00:00:00 2001 From: Ryan Currah Date: Thu, 28 Jul 2022 08:55:54 -0400 Subject: [PATCH] fix github action --- .github/workflows/go.yml | 14 +++++--------- .github/workflows/golangci-lint.yml | 19 ++++++++++++------- .github/workflows/snyk.yml | 3 ++- .golangci.yml | 18 ------------------ Makefile | 2 +- gomodguard.go | 5 +++-- 6 files changed, 23 insertions(+), 38 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 723e317..f550475 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -3,11 +3,11 @@ name: Go on: push: branches: - - master + - main pull_request: branches: - - master + - main permissions: actions: none @@ -26,15 +26,11 @@ jobs: name: Build runs-on: ubuntu-latest steps: - - - name: Set up Go 1.x - uses: actions/setup-go@v2 + - uses: actions/setup-go@v3 with: - go-version: ^1.16 - id: go + go-version: 1.17 - - name: Check out code into the Go module directory - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Build run: make build diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index d8bd9eb..3d7ddee 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -5,11 +5,11 @@ on: tags: - v* branches: - - master + - main pull_request: branches: - - master + - main permissions: actions: none @@ -28,8 +28,13 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: golangci-lint - uses: golangci/golangci-lint-action@v2 - with: - version: v1.39 + - uses: actions/setup-go@v3 + with: + go-version: 1.17 + + - uses: actions/checkout@v3 + + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest diff --git a/.github/workflows/snyk.yml b/.github/workflows/snyk.yml index 0f7f292..cc4ecb9 100644 --- a/.github/workflows/snyk.yml +++ b/.github/workflows/snyk.yml @@ -18,7 +18,8 @@ jobs: security: runs-on: ubuntu-latest steps: - - uses: actions/checkout@master + - uses: actions/checkout@v3 + - name: Run Snyk to check for vulnerabilities uses: snyk/actions/golang@master env: diff --git a/.golangci.yml b/.golangci.yml index fc05c0e..0fbf6c0 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,7 +7,6 @@ linters-settings: severity: warning rules: - name: atomic - # - name: bare-return - name: blank-imports - name: bool-literal-in-expr - name: call-to-gc @@ -28,7 +27,6 @@ linters-settings: - name: error-strings - name: errorf - name: exported - # - name: flag-parameter - name: get-return - name: identical-branches - name: if-return @@ -50,11 +48,9 @@ linters-settings: - name: unconditional-recursion - name: unexported-naming - name: unexported-return - # - name: unhandled-error - name: unnecessary-stmt - name: unreachable-code - name: unused-parameter - # - name: unused-receiver - name: var-declaration - name: var-naming - name: waitgroup-by-value @@ -64,7 +60,6 @@ linters: enable: - asciicheck - bodyclose - # - cyclop - deadcode - dogsled - dupl @@ -72,13 +67,9 @@ linters: - errcheck - errorlint - exhaustive - # - exhaustivestruct - exportloopref - # - forbidigo - forcetypeassert - funlen - # - gci - # - gochecknoglobals - gochecknoinits - gocognit - goconst @@ -86,16 +77,13 @@ linters: - gocyclo - godot - godox - - goerr113 - goimports - - gomnd - gomoddirectives - gomodguard - goprintffuncname - gosec - gosimple - govet - # - ifshort - importas - ineffassign - lll @@ -104,20 +92,16 @@ linters: - nakedret - nestif - nilerr - # - nlreturn - noctx - nolintlint - # - paralleltest - prealloc - predeclared - # - promlinter - revive - rowserrcheck - sqlclosecheck - staticcheck - structcheck - stylecheck - # - tagliatelle - testpackage - thelper - tparallel @@ -126,7 +110,5 @@ linters: - unparam - unused - varcheck - # - wastedassign - whitespace - # - wrapcheck - wsl diff --git a/Makefile b/Makefile index a196283..7666757 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ clean: rm -rf dist/ rm -f gomodguard coverage.xml coverage.out -.PHONY: install-tools-mac +.PHONY: install-mac-tools install-tools-mac: brew install goreleaser/tap/goreleaser diff --git a/gomodguard.go b/gomodguard.go index e2107ec..efd0d17 100644 --- a/gomodguard.go +++ b/gomodguard.go @@ -32,8 +32,9 @@ var ( blockReasonHasLocalReplaceDirective = "import of package `%s` is blocked because the module has a " + "local replace directive." - // startsWithVersion is used to test when a string begins with the version identifier of a module, after having stripped the prefix base module name - // ie "github.com/foo/bar/v2/baz" => "/v2/baz" probably indicates that the module is actually github.com/foo/bar/v2, not github.com/foo/bar + // startsWithVersion is used to test when a string begins with the version identifier of a module, + // after having stripped the prefix base module name. IE "github.com/foo/bar/v2/baz" => "/v2/baz" + // probably indicates that the module is actually github.com/foo/bar/v2, not github.com/foo/bar. startsWithVersion = regexp.MustCompile(`^\/v[0-9]+`) )