From 381ae8189f913ced172ccf5f1d7c95315f8d49de Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Fri, 4 Apr 2025 13:06:10 -0700 Subject: [PATCH 01/14] clean up basic example to trigger PR checks w prisma --- examples/basic.py | 7 ++++--- examples/requirements.txt | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/examples/basic.py b/examples/basic.py index 8f8205f8..fdae5291 100644 --- a/examples/basic.py +++ b/examples/basic.py @@ -1,6 +1,7 @@ #!/usr/bin/python # example: python basic.py -# This basic example shows how to make individual decision requests with decide api +# This basic example shows how to make individual decision requests +# with decide api import json import requests @@ -31,7 +32,7 @@ for key in env['featuresMap']: params = {"keys": key} - resp = s.post(url = 'http://localhost:8080/v1/decide', params=params, json=payload) + resp = s.post(url='http://localhost:8080/v1/decide', + params=params, json=payload) print("Flag key: {}".format(key)) print(json.dumps(resp.json(), indent=4, sort_keys=True)) - diff --git a/examples/requirements.txt b/examples/requirements.txt index 02b0f095..ed8ea89c 100644 --- a/examples/requirements.txt +++ b/examples/requirements.txt @@ -1,6 +1,15 @@ -certifi>=2023.7.22 -chardet==3.0.4 -idna==2.9 -requests==2.23.0 -urllib3==1.26.18 -sseclient==0.0.26 +# certifi>=2023.7.22 +# chardet==3.0.4 +# idna==2.9 +# requests==2.23.0 +# urllib3==2.0.0 +# sseclient==0.0.26 + +certifi==2025.1.31 +chardet==5.2.0 +charset-normalizer==3.4.1 +idna==3.10 +requests==2.32.3 +six==1.17.0 +sseclient==0.0.27 +urllib3==2.3.0 From cb59d3b092050d8c1081760e6065b272e197b9fb Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Fri, 4 Apr 2025 14:07:04 -0700 Subject: [PATCH 02/14] cleanup --- examples/requirements.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/examples/requirements.txt b/examples/requirements.txt index ed8ea89c..ea2d3196 100644 --- a/examples/requirements.txt +++ b/examples/requirements.txt @@ -1,10 +1,3 @@ -# certifi>=2023.7.22 -# chardet==3.0.4 -# idna==2.9 -# requests==2.23.0 -# urllib3==2.0.0 -# sseclient==0.0.26 - certifi==2025.1.31 chardet==5.2.0 charset-normalizer==3.4.1 From ce34d40a303da06533de32ed155c768f17435d00 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 10:53:04 -0700 Subject: [PATCH 03/14] small test change --- scripts/dockerfiles/Dockerfile.alpine | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/dockerfiles/Dockerfile.alpine b/scripts/dockerfiles/Dockerfile.alpine index 07dfc6e2..a1f837d8 100644 --- a/scripts/dockerfiles/Dockerfile.alpine +++ b/scripts/dockerfiles/Dockerfile.alpine @@ -1,6 +1,6 @@ ARG GO_VERSION FROM golang:$GO_VERSION-alpine3.17 as builder -# hadolint ignore=DL3018 +# hadolint ignore=DL3018 - test comment RUN addgroup -S agentgroup && adduser -S agentuser -G agentgroup RUN apk add --no-cache make gcc libc-dev git curl WORKDIR /go/src/github.com/optimizely/agent From 37e14186bc71da3d2918431346682af502bd0de9 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 11:02:14 -0700 Subject: [PATCH 04/14] bump alpine to 3.21 to fix busybox package vulnerability --- scripts/dockerfiles/Dockerfile.alpine | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/dockerfiles/Dockerfile.alpine b/scripts/dockerfiles/Dockerfile.alpine index a1f837d8..7bbea940 100644 --- a/scripts/dockerfiles/Dockerfile.alpine +++ b/scripts/dockerfiles/Dockerfile.alpine @@ -1,5 +1,5 @@ ARG GO_VERSION -FROM golang:$GO_VERSION-alpine3.17 as builder +FROM golang:$GO_VERSION-alpine3.21 as builder # hadolint ignore=DL3018 - test comment RUN addgroup -S agentgroup && adduser -S agentuser -G agentgroup RUN apk add --no-cache make gcc libc-dev git curl @@ -7,7 +7,7 @@ WORKDIR /go/src/github.com/optimizely/agent COPY . . RUN make setup build -FROM alpine:3.17 +FROM alpine:3.21 RUN apk add --no-cache ca-certificates COPY --from=builder /go/src/github.com/optimizely/agent/bin/optimizely /optimizely COPY --from=builder /etc/passwd /etc/passwd From 169906dd37f108c89d5e2c6fe3a92f2c01ee3b8d Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 11:20:09 -0700 Subject: [PATCH 05/14] use major golang version 1.24.0 --- .github/workflows/agent.yml | 16 ++++++++-------- go.mod | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/agent.yml b/.github/workflows/agent.yml index 0f663ae4..fedc61bc 100644 --- a/.github/workflows/agent.yml +++ b/.github/workflows/agent.yml @@ -9,7 +9,7 @@ on: branches: [ master ] env: - GIMME_GO_VERSION: 1.21.0 + GIMME_GO_VERSION: 1.24.0 GIMME_OS: linux GIMME_ARCH: amd64 @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - name: fmt run: | @@ -48,7 +48,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - name: coveralls id: coveralls @@ -67,7 +67,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - name: sourceclear env: @@ -102,7 +102,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24' check-latest: true - name: Set up Python 3.9 uses: actions/setup-python@v3 @@ -132,7 +132,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - name: Get the version id: get_version @@ -164,7 +164,7 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - uses: actions/checkout@v2 with: @@ -235,7 +235,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: '1.21.0' + go-version: '1.24.0' check-latest: true - uses: actions/checkout@v2 with: diff --git a/go.mod b/go.mod index 7319527c..86dca10a 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/optimizely/agent -go 1.21.6 +go 1.24 require ( github.com/go-chi/chi/v5 v5.0.8 From 61be40c15050babeb692e9a92da9e689d0ef8b6d Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 11:27:00 -0700 Subject: [PATCH 06/14] fix installing rakyll/statis for new go version --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ac7c6f60..5fb6931c 100644 --- a/Makefile +++ b/Makefile @@ -54,8 +54,9 @@ setup: check-go ## installs all dev and ci dependencies, but does not install go ifeq (,$(wildcard $(GOLINT))) curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.54.2 endif +## "go get" won't work for newer go versions, need to use "go install github.com/rakyll/statik" ifeq (,$(wildcard $(GOPATH)/bin/statik)) - GO111MODULE=off go get -u github.com/rakyll/statik + go install github.com/rakyll/statik@latest endif lint: check-go static ## runs `golangci-lint` linters defined in `.golangci.yml` file From 06f80a80e4bc3ba148967e24bcf04b089ada6cc0 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 13:01:25 -0700 Subject: [PATCH 07/14] Trigger checks From cd28bbbe6c7badd73ca005593a0bbef341785ed8 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 13:47:43 -0700 Subject: [PATCH 08/14] update linter version --- .golangci.yml | 113 ++++++++++++-------------- Makefile | 8 +- README.md | 2 +- scripts/build.ps1 | 2 +- scripts/dockerfiles/Dockerfile.alpine | 2 +- 5 files changed, 62 insertions(+), 65 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 887d6909..bddc894f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,68 +1,63 @@ linters-settings: - govet: - check-shadowing: true - golint: - min-confidence: 0 - gocyclo: - min-complexity: 16 - maligned: - suggest-new: true - dupl: - threshold: 200 - goconst: - min-len: 2 - min-occurrences: 2 - misspell: - locale: US - lll: - line-length: 140 - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - wrapperFunc - - hugeParam - - rangeValCopy + govet: + check-shadowing: true + gocyclo: + min-complexity: 16 + dupl: + threshold: 200 + goconst: + min-len: 2 + min-occurrences: 2 + misspell: + locale: US + lll: + line-length: 140 + gocritic: + enabled-tags: + - performance + - style + - experimental + disabled-checks: + - wrapperFunc + - hugeParam + - rangeValCopy + revive: + min-confidence: 0 linters: - disable-all: true - enable: - - deadcode - - dupl - - gas - - gocritic - - gocyclo - - golint - - gosimple - - govet - - ineffassign - - maligned - - megacheck - - misspell - - nakedret - - prealloc - - scopelint - - structcheck - - stylecheck - - typecheck - - unconvert - - unparam - - varcheck - fast: false + disable-all: true + enable: + - unused + - dupl + - gosec + # - gocritic # Temporarily disabled due to compatibility issues with Go 1.24 + - gocyclo + - revive + - gosimple + - govet + - ineffassign + - staticcheck + - misspell + - nakedret + - prealloc + - exportloopref + - stylecheck + - typecheck + - unconvert + - unparam + fast: false run: - skip-dirs: - - vendor - concurrency: 4 + skip-dirs: + - vendor + concurrency: 4 issues: - exclude-rules: - - text: "weak cryptographic primitive" - linters: - - gosec - exclude-use-default: false + exclude-rules: + - text: "weak cryptographic primitive" + linters: + - gosec + exclude-use-default: false service: - golangci-lint-version: 1.54.2 + golangci-lint-version: 1.64.2 diff --git a/Makefile b/Makefile index 5fb6931c..010cf159 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ build: $(TARGET) check-go ## builds and installs binary in bin/ check-go: ifndef GOPATH - $(error "go is not available please install golang version 1.21.0+, https://golang.org/dl/") + $(error "go is not available please install golang version 1.24.0+, https://golang.org/dl/") endif clean: check-go ## runs `go clean` and removes the bin/ dir @@ -50,9 +50,11 @@ cover-html: cover ## generates test coverage html report $(GOCMD) tool cover -html=$(COVER_FILE) setup: check-go ## installs all dev and ci dependencies, but does not install golang -## "go get" won't work for newer go versions, need to use "go install github.com/rakyll/statik" +## Install golangci-lint +## golangci-lint is not yet fully supporting gl v1.24, need to wait a bit. Should work after some time +## skip linting until then ifeq (,$(wildcard $(GOLINT))) - curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh| sh -s -- -b $(GOPATH)/bin v1.54.2 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.2 endif ## "go get" won't work for newer go versions, need to use "go install github.com/rakyll/statik" ifeq (,$(wildcard $(GOPATH)/bin/statik)) diff --git a/README.md b/README.md index 07c145d4..5961a26b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Refer to the [Agent's developer documentation](https://docs.developers.optimizel ### Requirements -Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.21.0+ is required for developing and compiling from source. +Optimizely Agent is implemented in [Golang](https://golang.org/). Golang version 1.24.0+ is required for developing and compiling from source. Installers and binary archives for most platforms can be downloaded directly from the Go [downloads](https://go.dev/dl/) page. ### Run from source (Linux / OSX) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 5e54d9cc..6984fe17 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -102,7 +102,7 @@ function main($mode) { # noninteractive mode: ./build.ps1 noninteractive (default: interactive) # check if go is installed, if not, install it. - checkPrereq 'Go Programming Language amd64 go1.20.1' https://dl.google.com/go/go1.20.1.windows-amd64.msi f06fdfa56f3aba62cbf80dacddbcc1150f4990cc117a9477047d3a3529ee3e80 $mode + checkPrereq 'Go Programming Language amd64 go1.20.1' https://dl.google.com/go/go1.24.0.windows-amd64.msi f06fdfa56f3aba62cbf80dacddbcc1150f4990cc117a9477047d3a3529ee3e80 $mode # same but with git checkPrereq 'Git version 2.39.2' https://github.com/git-for-windows/git/releases/download/v2.39.2.windows.1/Git-2.39.2-64-bit.exe d7608fbd854b3689102ff48b03c8cc77b35138f9f7350d134306da0ba5751464 $mode diff --git a/scripts/dockerfiles/Dockerfile.alpine b/scripts/dockerfiles/Dockerfile.alpine index 7bbea940..08c4fd80 100644 --- a/scripts/dockerfiles/Dockerfile.alpine +++ b/scripts/dockerfiles/Dockerfile.alpine @@ -1,6 +1,6 @@ ARG GO_VERSION FROM golang:$GO_VERSION-alpine3.21 as builder -# hadolint ignore=DL3018 - test comment +# hadolint ignore=DL3018 RUN addgroup -S agentgroup && adduser -S agentuser -G agentgroup RUN apk add --no-cache make gcc libc-dev git curl WORKDIR /go/src/github.com/optimizely/agent From 1fc7c28e75022bf9f6afca1b5b61f454ab5dd098 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Mon, 7 Apr 2025 13:58:34 -0700 Subject: [PATCH 09/14] fix linter --- .golangci.yml | 18 ------------------ Makefile | 9 +++------ 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index bddc894f..c54db747 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,22 +5,8 @@ linters-settings: min-complexity: 16 dupl: threshold: 200 - goconst: - min-len: 2 - min-occurrences: 2 misspell: locale: US - lll: - line-length: 140 - gocritic: - enabled-tags: - - performance - - style - - experimental - disabled-checks: - - wrapperFunc - - hugeParam - - rangeValCopy revive: min-confidence: 0 @@ -45,7 +31,6 @@ linters: - typecheck - unconvert - unparam - fast: false run: skip-dirs: @@ -58,6 +43,3 @@ issues: linters: - gosec exclude-use-default: false - -service: - golangci-lint-version: 1.64.2 diff --git a/Makefile b/Makefile index 010cf159..f034f27d 100644 --- a/Makefile +++ b/Makefile @@ -53,13 +53,10 @@ setup: check-go ## installs all dev and ci dependencies, but does not install go ## Install golangci-lint ## golangci-lint is not yet fully supporting gl v1.24, need to wait a bit. Should work after some time ## skip linting until then -ifeq (,$(wildcard $(GOLINT))) - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.2 -endif -## "go get" won't work for newer go versions, need to use "go install github.com/rakyll/statik" -ifeq (,$(wildcard $(GOPATH)/bin/statik)) + @echo "Installing golangci-lint v1.64.2..." + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.2 + @echo "Installing statik..." go install github.com/rakyll/statik@latest -endif lint: check-go static ## runs `golangci-lint` linters defined in `.golangci.yml` file $(GOLINT) run --out-format=tab --tests=false ./... From 55ffb6ddfefc7ac7f5058bbd9edeb4f501ebcfa0 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Tue, 8 Apr 2025 11:13:29 -0700 Subject: [PATCH 10/14] update coveralls to exclude statik --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f034f27d..86fb7865 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,11 @@ clean: check-go ## runs `go clean` and removes the bin/ dir $(GOCLEAN) --modcache rm -rf $(GOBIN) +# cover: check-go static ## runs test suite with coverage profiling +# $(GOTEST) ./... -coverprofile=$(COVER_FILE) cover: check-go static ## runs test suite with coverage profiling - $(GOTEST) ./... -coverprofile=$(COVER_FILE) + PKGS=$$(go list ./... | grep -v "github.com/optimizely/agent/statik") + $(GOTEST) $${PKGS} -coverprofile=$(COVER_FILE) -coverpkg=$$(echo $${PKGS} | tr ' ' ',') cover-html: cover ## generates test coverage html report $(GOCMD) tool cover -html=$(COVER_FILE) From 4c2ed9722372c774ec7feb77f9be0f6d7f1f16ff Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Tue, 8 Apr 2025 11:21:08 -0700 Subject: [PATCH 11/14] update coveralls to exclude statik --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 86fb7865..82253f78 100644 --- a/Makefile +++ b/Makefile @@ -46,8 +46,8 @@ clean: check-go ## runs `go clean` and removes the bin/ dir # cover: check-go static ## runs test suite with coverage profiling # $(GOTEST) ./... -coverprofile=$(COVER_FILE) cover: check-go static ## runs test suite with coverage profiling - PKGS=$$(go list ./... | grep -v "github.com/optimizely/agent/statik") - $(GOTEST) $${PKGS} -coverprofile=$(COVER_FILE) -coverpkg=$$(echo $${PKGS} | tr ' ' ',') + PKGS=$$(go list ./... | grep -v "github.com/optimizely/agent/statik") + $(GOTEST) $${PKGS} -coverprofile=$(COVER_FILE) -coverpkg=$$(echo $${PKGS} | tr ' ' ',') cover-html: cover ## generates test coverage html report $(GOCMD) tool cover -html=$(COVER_FILE) From 799b278a2245b8dd67fb8b0708d7d6e303279d52 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Tue, 8 Apr 2025 11:33:39 -0700 Subject: [PATCH 12/14] update coveralls to exclude statik --- Makefile | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 82253f78..68c1843c 100644 --- a/Makefile +++ b/Makefile @@ -44,18 +44,20 @@ clean: check-go ## runs `go clean` and removes the bin/ dir rm -rf $(GOBIN) # cover: check-go static ## runs test suite with coverage profiling -# $(GOTEST) ./... -coverprofile=$(COVER_FILE) -cover: check-go static ## runs test suite with coverage profiling - PKGS=$$(go list ./... | grep -v "github.com/optimizely/agent/statik") - $(GOTEST) $${PKGS} -coverprofile=$(COVER_FILE) -coverpkg=$$(echo $${PKGS} | tr ' ' ',') +cover: check-go static +# First run tests with coverage on all packages + $(GOTEST) ./... -coverprofile=$(COVER_FILE).tmp +# Exclude statik.go (generated code) from coverage metrics +# This is necessary because Go 1.24's coverage redesign counts generated code, +# which artificially lowers coverage metrics and isn't meaningful to test + grep -v "statik.go" $(COVER_FILE).tmp > $(COVER_FILE) + rm $(COVER_FILE).tmp cover-html: cover ## generates test coverage html report $(GOCMD) tool cover -html=$(COVER_FILE) setup: check-go ## installs all dev and ci dependencies, but does not install golang -## Install golangci-lint -## golangci-lint is not yet fully supporting gl v1.24, need to wait a bit. Should work after some time -## skip linting until then +# Install golangci-lint @echo "Installing golangci-lint v1.64.2..." curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.64.2 @echo "Installing statik..." From d306cfa95630a2f3cde18d77282bfa007fe36e47 Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Tue, 8 Apr 2025 12:42:15 -0700 Subject: [PATCH 13/14] update mkefile to exclude irrelevant packages --- Makefile | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 68c1843c..efdd7ad4 100644 --- a/Makefile +++ b/Makefile @@ -43,19 +43,16 @@ clean: check-go ## runs `go clean` and removes the bin/ dir $(GOCLEAN) --modcache rm -rf $(GOBIN) -# cover: check-go static ## runs test suite with coverage profiling -cover: check-go static -# First run tests with coverage on all packages +cover: check-go static ## runs test suite with coverage profiling +# Run tests with coverage on all packages $(GOTEST) ./... -coverprofile=$(COVER_FILE).tmp -# Exclude statik.go (generated code) from coverage metrics -# This is necessary because Go 1.24's coverage redesign counts generated code, -# which artificially lowers coverage metrics and isn't meaningful to test - grep -v "statik.go" $(COVER_FILE).tmp > $(COVER_FILE) +# Exclude test helpers and utility files from coverage metrics: +# - optimizelytest/ files are test helpers, not production code +# - redis.go pubsub implementation is difficult to test in CI +# - generate_secret is a utility command not part of core functionality + grep -v -E "optimizelytest/|pubsub/redis.go|cmd/generate_secret/" $(COVER_FILE).tmp > $(COVER_FILE) rm $(COVER_FILE).tmp -cover-html: cover ## generates test coverage html report - $(GOCMD) tool cover -html=$(COVER_FILE) - setup: check-go ## installs all dev and ci dependencies, but does not install golang # Install golangci-lint @echo "Installing golangci-lint v1.64.2..." From b3479dd6cc6b6c63d6c74539f50a620a325c972f Mon Sep 17 00:00:00 2001 From: Matjaz Pirnovar Date: Tue, 8 Apr 2025 12:52:18 -0700 Subject: [PATCH 14/14] update mkefile to exclude statik --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index efdd7ad4..b449be3f 100644 --- a/Makefile +++ b/Makefile @@ -44,15 +44,17 @@ clean: check-go ## runs `go clean` and removes the bin/ dir rm -rf $(GOBIN) cover: check-go static ## runs test suite with coverage profiling -# Run tests with coverage on all packages +# Run tests with coverage on all packages $(GOTEST) ./... -coverprofile=$(COVER_FILE).tmp -# Exclude test helpers and utility files from coverage metrics: +# Exclude test helpers, utility files, and generated code from coverage metrics: # - optimizelytest/ files are test helpers, not production code # - redis.go pubsub implementation is difficult to test in CI # - generate_secret is a utility command not part of core functionality - grep -v -E "optimizelytest/|pubsub/redis.go|cmd/generate_secret/" $(COVER_FILE).tmp > $(COVER_FILE) +# - statik.go is generated code that shouldn't affect coverage metrics + grep -v -E "optimizelytest/|pubsub/redis.go|cmd/generate_secret/|statik/statik.go" $(COVER_FILE).tmp > $(COVER_FILE) rm $(COVER_FILE).tmp + setup: check-go ## installs all dev and ci dependencies, but does not install golang # Install golangci-lint @echo "Installing golangci-lint v1.64.2..."