From beb87544b2445f534912563d12bc3e60b466fc74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 12:27:17 +0200 Subject: [PATCH 01/13] ci: update workflows --- .github/workflows/dockerimage.yml | 77 ---------------------------- .github/workflows/documentation.yaml | 28 ---------- .github/workflows/release.yaml | 48 +++++++++++++++++ .github/workflows/test.yaml | 61 ++++++++++++++++++++++ 4 files changed, 109 insertions(+), 105 deletions(-) delete mode 100644 .github/workflows/dockerimage.yml delete mode 100644 .github/workflows/documentation.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/dockerimage.yml b/.github/workflows/dockerimage.yml deleted file mode 100644 index 29b9ad7..0000000 --- a/.github/workflows/dockerimage.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Docker - -on: - push: - # Publish `master` as Docker `latest` image. - branches: - - main - - # Publish `v1.2.3` tags as releases. - tags: - - v* - - # Run tests for any PRs. - pull_request: - -jobs: - # Run tests. - # See also https://docs.docker.com/docker-hub/builds/automated-testing/ - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Run tests - run: | - if [ -f docker-compose.test.yml ]; then - docker-compose --file docker-compose.test.yml build - docker-compose --file docker-compose.test.yml run sut - else - docker build . --file Dockerfile - fi - - # Push image to GitHub Packages. - # See also https://docs.docker.com/docker-hub/builds/ - push: - # Ensure test job passes before pushing image. - needs: test - - runs-on: ubuntu-latest - if: github.event_name == 'push' - - steps: - - uses: actions/checkout@v2 - - - name: Build image - run: docker build . --file Dockerfile --tag image - - - name: Log into registry - run: echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin - - - name: Push image - run: | - IMAGE_ID=ghcr.io/${{ github.repository }} - - # Strip git ref prefix from version - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - - # Strip "v" prefix from tag name - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - - # Use Docker `latest` tag convention - [ "$VERSION" == "main" ] && VERSION=latest - - echo IMAGE_ID=$IMAGE_ID - echo VERSION=$VERSION - - docker tag image $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION - - #- name: Publish to Registry - # uses: elgohr/Publish-Docker-Github-Action@master - # with: - # name: norsknettarkiv/veidemann-scopeservice - # username: ${{ secrets.DOCKER_USERNAME }} - # password: ${{ secrets.DOCKER_PASSWORD }} - # tag_names: true diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml deleted file mode 100644 index 1d11626..0000000 --- a/.github/workflows/documentation.yaml +++ /dev/null @@ -1,28 +0,0 @@ -name: github pages - -on: - push: - branches: - - main # Set a branch to deploy - -jobs: - deploy: - runs-on: ubuntu-18.04 - steps: - - uses: actions/checkout@v2 - with: - submodules: false # Fetch Hugo themes (true OR recursive) - fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod - - - name: Setup Hugo - uses: peaceiris/actions-hugo@v2 - with: - hugo-version: 'latest' - # extended: true - - - name: Build - run: hugo -s docsrc --minify - - - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Generate documentation diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..d9df6e0 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,48 @@ +name: Release + +on: + push: + branches: + - main + tags: + - "v[0-9]+.[0-9]+.[0-9]+**" + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + container: + name: Create and publish container image + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Extract metadata (tags, labels, version) for container image + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=ref,event=branch + type=ref,event=pr + + - name: Log in to the container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..bd7d2a0 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,61 @@ +name: Test + +on: [push] + +permissions: + contents: read + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + unit_test: + name: Golang unit tests + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - name: Build + run: go build ./... + - name: Run test + run: go test ./... + lint: + name: Linting + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - uses: golangci/golangci-lint-action@v6 + with: + version: latest + # Enable additional linters (see: https://golangci-lint.run/usage/linters/) + args: -E "bodyclose" -E "dogsled" -E "durationcheck" -E "errorlint" -E "forcetypeassert" -E "noctx" -E "exhaustive" -E "exportloopref" --timeout 3m0s + build_container: + name: Build container image + runs-on: ubuntu-latest + steps: + - name: Extract metadata (tags, labels) for container image + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=ref,event=branch + type=ref,event=pr + - name: Build container image + uses: docker/build-push-action@v6 + with: + push: false + build-args: | + VERSION=${{ steps.meta.outputs.version }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} From 1418e75a8c79b2d8c6f416ae7dabc266bd78ef6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 13:13:56 +0200 Subject: [PATCH 02/13] feat: add parser option to preserve old behavior See https://github.com/nlnwa/whatwg-url/commit/e6991e3100b53bcbb1318aadca4414bf539c1891 --- pkg/script/canon_profiles.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/script/canon_profiles.go b/pkg/script/canon_profiles.go index 98880cc..78cf7ee 100644 --- a/pkg/script/canon_profiles.go +++ b/pkg/script/canon_profiles.go @@ -11,6 +11,7 @@ var CrawlCanonicalizationProfile url.Parser func InitializeCanonicalizationProfiles(includeFragment bool) { opts := []url.ParserOption{ url.WithCollapseConsecutiveSlashes(), + url.WithSkipEqualsForEmptySearchParamsValue(), canonicalizer.WithRemoveUserInfo(), canonicalizer.WithRepeatedPercentDecoding(), canonicalizer.WithSortQuery(canonicalizer.SortKeys), @@ -23,6 +24,7 @@ func InitializeCanonicalizationProfiles(includeFragment bool) { opts = []url.ParserOption{ url.WithCollapseConsecutiveSlashes(), + url.WithSkipEqualsForEmptySearchParamsValue(), canonicalizer.WithRemoveUserInfo(), canonicalizer.WithSortQuery(canonicalizer.SortKeys), canonicalizer.WithDefaultScheme("http"), From ce306e0e39dca03e5b42db7e51417fd10c4f4b8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 13:27:02 +0200 Subject: [PATCH 03/13] test: update test case This commit updates a test case because of upstream changes. See https://github.com/nlnwa/whatwg-url/commit/83994ffc75baec9150b9d78515952849d70c6d0d --- pkg/server/server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/server/server_test.go b/pkg/server/server_test.go index daf4935..bf32ddb 100644 --- a/pkg/server/server_test.go +++ b/pkg/server/server_test.go @@ -112,7 +112,7 @@ func TestScopeCheckerServer_ScopeCheck(t *testing.T) { Error: &commons.Error{ Code: -7, Msg: "error parsing uri", - Detail: "Error: 504: illegal host, Url: http://%00foo.bar/aa bb/cc?jsessionid=1&foo#bar, Cause: Error: 100: illegal code point '\x00'", + Detail: "Error: The host contains a forbidden domain code point: '\x00'. Url: 'http://%00foo.bar/aa bb/cc?jsessionid=1&foo#bar'", }, }}, } From 02a1e75a88852a2fdfee5d51896e099a4838d09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:04:27 +0200 Subject: [PATCH 04/13] refactor: deprecate use of global resolve package variables --- pkg/script/script.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pkg/script/script.go b/pkg/script/script.go index c58372d..f3e0a62 100644 --- a/pkg/script/script.go +++ b/pkg/script/script.go @@ -2,17 +2,18 @@ package script import ( "errors" + "os" + "strings" + "time" + "veidemann-scopeservice/pkg/telemetry" + "github.com/nlnwa/veidemann-api/go/commons/v1" "github.com/nlnwa/veidemann-api/go/frontier/v1" "github.com/nlnwa/veidemann-api/go/scopechecker/v1" "github.com/prometheus/client_golang/prometheus" "github.com/rs/zerolog" - "go.starlark.net/resolve" "go.starlark.net/starlark" - "os" - "strings" - "time" - "veidemann-scopeservice/pkg/telemetry" + "go.starlark.net/syntax" ) const ( @@ -29,12 +30,11 @@ var scriptLogger = zerolog.New(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: // RunScopeScript runs the Scope checking script and returns the Scope status. func RunScopeScript(name string, src interface{}, qUri *frontier.QueuedUri, debug bool) *scopechecker.ScopeCheckResponse { - resolve.AllowNestedDef = true // allow def statements within function bodies - resolve.AllowLambda = true // allow lambda expressions - resolve.AllowFloat = true // allow floating point literals, the 'float' built-in, and x / y - resolve.AllowSet = true // allow the 'set' built-in - resolve.AllowGlobalReassign = true // allow reassignment to top-level names; also, allow if/for/while at top-level - resolve.AllowRecursion = true // allow while statements and recursive functions + options := &syntax.FileOptions{ + Set: true, // allow the 'set' built-in + Recursion: true, // allow while statements and recursive functions + GlobalReassign: true, // allow reassignment to top-level names; also, allow if/for/while at top-level + } consoleLog := strings.Builder{} @@ -58,7 +58,7 @@ func RunScopeScript(name string, src interface{}, qUri *frontier.QueuedUri, debu // Compile source t := prometheus.NewTimer(telemetry.CompileScriptSeconds) - _, prog, err := starlark.SourceProgram(name, src, starlark.StringDict{}.Has) + _, prog, err := starlark.SourceProgramOptions(options, name, src, starlark.StringDict{}.Has) if err != nil { return &scopechecker.ScopeCheckResponse{ Evaluation: scopechecker.ScopeCheckResponse_EXCLUDE, From f241da5913385e71c89f24a44e4ba2ac2131b88f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:05:09 +0200 Subject: [PATCH 05/13] lint: check assertion --- pkg/script/matchers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/script/matchers.go b/pkg/script/matchers.go index 554f40b..30658f7 100644 --- a/pkg/script/matchers.go +++ b/pkg/script/matchers.go @@ -30,7 +30,10 @@ func isScheme(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tuple, if err := starlark.UnpackPositionalArgs(b.Name(), args, kwargs, 1, &scheme); err != nil { return nil, err } - qUrl := thread.Local(urlKey).(*UrlValue) + qUrl, ok := thread.Local(urlKey).(*UrlValue) + if !ok { + return nil, fmt.Errorf("url not set") + } s := strings.TrimRight(qUrl.parsedUri.Protocol(), ":") scheme = strings.ToLower(scheme) match := False From f4671d633c8f1cf4705a14d8116fc72e74a10a0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:09:18 +0200 Subject: [PATCH 06/13] refactor: replace deprecated prometheus.NewBuildInfoCollector --- pkg/telemetry/metrics_server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/telemetry/metrics_server.go b/pkg/telemetry/metrics_server.go index 5eccd7f..2a0271f 100644 --- a/pkg/telemetry/metrics_server.go +++ b/pkg/telemetry/metrics_server.go @@ -21,6 +21,7 @@ import ( "fmt" "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" + "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog/log" "net/http" @@ -50,7 +51,7 @@ func NewMetricsServer(listenInterface string, listenPort int, path string) *Metr ScopecheckResponseTotal, CompileScriptSeconds, ExecuteScriptSeconds, - prometheus.NewBuildInfoCollector(), + collectors.NewBuildInfoCollector(), ) }) From 1c32c469de1c13332109094535752ad9ee9aea55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:10:05 +0200 Subject: [PATCH 07/13] fix: use buffered signal channel as argument to signal.Notify --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index c5d5773..a5856c2 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,7 @@ func main() { defer ms.Close() go func() { - signals := make(chan os.Signal) + signals := make(chan os.Signal, 2) signal.Notify(signals, os.Interrupt, syscall.SIGTERM) select { From 6129b09fa11aa9ce8637f3343fbc6f0428a7f2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:22:14 +0200 Subject: [PATCH 08/13] refactor: remove nil check after assignment --- pkg/script/status.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/script/status.go b/pkg/script/status.go index e5d6d04..d533bcb 100644 --- a/pkg/script/status.go +++ b/pkg/script/status.go @@ -58,21 +58,24 @@ var statusValues = map[string]Status{ type Status int32 +// Implement starlark.Value interface func (s Status) Type() string { return "end of computation status" } func (s Status) Freeze() {} // immutable func (s Status) Truth() starlark.Bool { return true } func (s Status) Hash() (uint32, error) { return starlark.MakeUint(uint(s)).Hash() } func (s Status) String() string { return statusNames[s] } +// Implement starlark.Unpacker interface func (s *Status) Unpack(v starlark.Value) error { switch val := v.(type) { case Status: *s = val case starlark.String: - *s = statusValues[val.GoString()] - if s == nil { + value, ok := statusValues[val.GoString()] + if !ok { return errors.New("Illegal type " + val.String()) } + *s = value default: return errors.New("Illegal type " + val.String()) } From 55a49fcba82e92bad100b48919ab8f0ed925e2e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:28:36 +0200 Subject: [PATCH 09/13] refactor: use errors.Is --- pkg/script/matchers.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/script/matchers.go b/pkg/script/matchers.go index 30658f7..8c23549 100644 --- a/pkg/script/matchers.go +++ b/pkg/script/matchers.go @@ -1,6 +1,7 @@ package script import ( + "errors" "fmt" "go.starlark.net/starlark" "strings" @@ -119,7 +120,7 @@ func maxHopsFromSeed(thread *starlark.Thread, b *starlark.Builtin, args starlark if h, err := parameterAsInt64(maxHops); err == nil { match = len(discoveryPath) > int(h) } else { - if err != None { + if errors.Is(err, None) { return nil, err } } From 2508070da89a1ac6e1d26976feeee3eb64ebce32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:51:47 +0200 Subject: [PATCH 10/13] refactor: use errors.As over comparing with == --- pkg/script/script.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/script/script.go b/pkg/script/script.go index f3e0a62..ce70fe2 100644 --- a/pkg/script/script.go +++ b/pkg/script/script.go @@ -101,11 +101,13 @@ func RunScopeScript(name string, src interface{}, qUri *frontier.QueuedUri, debu _, err = prog.Init(thread, nil) t.ObserveDuration() if err != nil { - if evalErr, ok := err.(*starlark.EvalError); ok { - if evalErr.Unwrap() == EndOfComputation { + evalErr := new(starlark.EvalError) + if errors.As(err, &evalErr) { + if errors.Is(evalErr, EndOfComputation) { // Computation was aborted } else { - if w, ok := evalErr.Unwrap().(*wrappedError); ok { + w := new(wrappedError) + if errors.As(evalErr, &w) { // Script returned Status wrapped as Error e := (*commons.Error)(w) return &scopechecker.ScopeCheckResponse{ From 574742d5aa915623fda016460118f10ee609503d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:53:17 +0200 Subject: [PATCH 11/13] refactor: check type assertion --- pkg/script/matchers.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/script/matchers.go b/pkg/script/matchers.go index 8c23549..da0f951 100644 --- a/pkg/script/matchers.go +++ b/pkg/script/matchers.go @@ -55,7 +55,10 @@ func isReferrer(thread *starlark.Thread, b *starlark.Builtin, args starlark.Tupl if err := starlark.UnpackPositionalArgs(b.Name(), args, kwargs, 1, &referrer); err != nil { return nil, err } - qUrl := thread.Local(urlKey).(*UrlValue) + qUrl, ok := thread.Local(urlKey).(*UrlValue) + if !ok { + return nil, fmt.Errorf("url not set") + } s := strings.TrimSpace(qUrl.qUri.Referrer) referrer = strings.ToLower(referrer) match := False From f43b01fee924a62bfc1d72e8b03016288242b7c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 14:53:34 +0200 Subject: [PATCH 12/13] style: format --- main.go | 8 +++++--- pkg/script/matchers.go | 3 ++- pkg/script/status.go | 15 ++++++++------- pkg/telemetry/metrics_server.go | 7 ++++--- 4 files changed, 19 insertions(+), 14 deletions(-) diff --git a/main.go b/main.go index a5856c2..fe75408 100644 --- a/main.go +++ b/main.go @@ -1,8 +1,6 @@ package main import ( - "github.com/opentracing/opentracing-go" - "github.com/rs/zerolog/log" "os" "os/signal" "syscall" @@ -11,9 +9,13 @@ import ( "veidemann-scopeservice/pkg/server" "veidemann-scopeservice/pkg/telemetry" + "github.com/opentracing/opentracing-go" + "github.com/rs/zerolog/log" + + "strings" + "github.com/spf13/pflag" "github.com/spf13/viper" - "strings" ) func main() { diff --git a/pkg/script/matchers.go b/pkg/script/matchers.go index da0f951..6e2cd0b 100644 --- a/pkg/script/matchers.go +++ b/pkg/script/matchers.go @@ -3,8 +3,9 @@ package script import ( "errors" "fmt" - "go.starlark.net/starlark" "strings" + + "go.starlark.net/starlark" ) func init() { diff --git a/pkg/script/status.go b/pkg/script/status.go index d533bcb..92147d9 100644 --- a/pkg/script/status.go +++ b/pkg/script/status.go @@ -3,6 +3,7 @@ package script import ( "errors" "fmt" + "github.com/nlnwa/veidemann-api/go/commons/v1" "github.com/nlnwa/veidemann-api/go/scopechecker/v1" "go.starlark.net/starlark" @@ -10,13 +11,13 @@ import ( // init inserts constants into starlark environment. // -// * -5 RUNTIME_EXCEPTION Unexpected runtime exception. -// * -7 ILLEGAL_URI URI recognized as unsupported or illegal. -// * -4000 CHAFF_DETECTION Chaff detection of traps/content with negligible value applied. -// * -4001 TOO_MANY_HOPS The URI is too many link hops away from the seed. -// * -4002 TOO_MANY_TRANSITIVE_HOPS The URI is too many embed/transitive hops away from the last URI in scope. -// * -5001 BLOCKED Blocked from fetch by user setting. -// * -5002 BLOCKED_BY_CUSTOM_PROCESSOR Blocked by a custom processor. +// - -5 RUNTIME_EXCEPTION Unexpected runtime exception. +// - -7 ILLEGAL_URI URI recognized as unsupported or illegal. +// - -4000 CHAFF_DETECTION Chaff detection of traps/content with negligible value applied. +// - -4001 TOO_MANY_HOPS The URI is too many link hops away from the seed. +// - -4002 TOO_MANY_TRANSITIVE_HOPS The URI is too many embed/transitive hops away from the last URI in scope. +// - -5001 BLOCKED Blocked from fetch by user setting. +// - -5002 BLOCKED_BY_CUSTOM_PROCESSOR Blocked by a custom processor. func init() { for k, v := range statusValues { starlark.Universe[k] = v diff --git a/pkg/telemetry/metrics_server.go b/pkg/telemetry/metrics_server.go index 2a0271f..3ff1bcc 100644 --- a/pkg/telemetry/metrics_server.go +++ b/pkg/telemetry/metrics_server.go @@ -19,14 +19,15 @@ package telemetry import ( "context" "fmt" + "net/http" + "sync" + "time" + "github.com/pkg/errors" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/collectors" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog/log" - "net/http" - "sync" - "time" ) var once sync.Once From 084e96746858e9ac91501b6b2f9c7ffe96a66a64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marius=20Andr=C3=A9=20Elsfjordstrand=20Beck?= Date: Thu, 18 Jul 2024 15:00:50 +0200 Subject: [PATCH 13/13] ci: use default golangci-lint config --- .github/workflows/test.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index bd7d2a0..44d1a4b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -36,8 +36,6 @@ jobs: - uses: golangci/golangci-lint-action@v6 with: version: latest - # Enable additional linters (see: https://golangci-lint.run/usage/linters/) - args: -E "bodyclose" -E "dogsled" -E "durationcheck" -E "errorlint" -E "forcetypeassert" -E "noctx" -E "exhaustive" -E "exportloopref" --timeout 3m0s build_container: name: Build container image runs-on: ubuntu-latest