Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
fetch-depth: 0 # Get tags to allow build script to get build version

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.24.x
go-version-file: 'go.mod'

- name: Build
run: make build_amd
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ jobs:
fetch-depth: 0 # Get tags to allow build script to get build version

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.24.x
go-version-file: 'go.mod'

- name: Setup Version
run: make version

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v9
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ jobs:
fetch-depth: 0 # Get tags to allow build script to get build version

- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: 1.24.x
go-version-file: 'go.mod'

- name: Build
run: |
Expand Down
117 changes: 55 additions & 62 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,16 @@
version: "2"
run:
timeout: 5m

linters-settings:
cyclop:
max-complexity: 30
package-average: 10.0
errcheck:
check-type-assertions: true
exhaustive:
check:
- switch
- map
funlen:
lines: 150
statements: 80
gocognit:
min-complexity: 25
gosec:
excludes:
- G204
govet:
enable-all: true
disable-all: false
disable:
- fieldalignment
nakedret:
max-func-lines: 10
lll:
line-length: 180
revive:
# Increase confidence to reduce false positives
confidence: 0.8
rules:
- name: exported
severity: error
disabled: false
arguments:
- "checkPrivateReceivers"
- name: package-comments
severity: error
disabled: false
- name: comment-spacings
severity: warning
disabled: false
godot:
scope: toplevel
exclude:
- "^fixme:"
- "^todo:"
- "^NOTE:"
period: true
capital: true
formatters:
enable:
- gci
- goimports
settings:
gci:
sections:
- standard
- default

linters:
enable:
Expand All @@ -62,7 +22,6 @@ linters:
- goconst
- gocritic
- godot
- goimports
- gosec
- lll
- loggercheck
Expand All @@ -74,19 +33,53 @@ linters:
- nonamedreturns
- predeclared
- reassign
- revive
- stylecheck
- staticcheck
- unconvert
- unparam
- usestdlibvars
- whitespace

issues:
exclude-dirs:
- tests
exclude-rules:
- path: _test\.go
linters:
- gocognit
- godot
- funlen
settings:
cyclop:
max-complexity: 30
package-average: 10.0
errcheck:
check-type-assertions: true
exhaustive:
check:
- switch
- map
funlen:
lines: 150
statements: 80
gocognit:
min-complexity: 40
gosec:
excludes:
- G117
- G304
govet:
enable-all: true
disable:
- fieldalignment
settings:
shadow:
strict: true
nakedret:
max-func-lines: 10
lll:
line-length: 180
staticcheck:
checks: ["all", "-SA1019"]

exclusions:
paths:
- tests
rules:
- path: _test\.go
linters:
- gocognit
- govet
- cyclop
- godot
- funlen
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.6.3] - 2026-03-10
### Added
- Add dynamic support for loading env vars (from file) during startup.
- Add `build_local` target to Makefile for local execution.
- Upgraded to golang 1.25

## [1.6.2] - 2026-02-26
### Added
Expand Down Expand Up @@ -189,4 +194,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[1.6.0]: https://github.com/scanoss/api.go/compare/v1.5.2...v1.6.0
[1.6.1]: https://github.com/scanoss/api.go/compare/v1.6.0...v1.6.1
[1.6.2]: https://github.com/scanoss/api.go/compare/v1.6.1...v1.6.2

[1.6.3]: https://github.com/scanoss/api.go/compare/v1.6.2...v1.6.3
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24 AS build
FROM golang:1.25 AS build

WORKDIR /app

Expand All @@ -16,7 +16,7 @@ FROM build AS test

COPY test-support/scanoss.sh /app/scanoss.sh

FROM debian:buster-slim AS production
FROM debian:bookworm-slim AS production

WORKDIR /app

Expand Down
16 changes: 13 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ DOCKER=$(shell which docker)
DOCKER_FULLNAME=${REPO}/${IMAGE_NAME}
GHCR_FULLNAME=ghcr.io/${REPO}/${IMAGE_NAME}
VERSION=$(shell ./version.sh)
# Linter version
LINT_VERSION := v2.11.3

# HELP
# This will output the help for each task
Expand Down Expand Up @@ -58,7 +60,10 @@ lint_local_fix: ## Run local instance of linting across the code base including
golangci-lint run --fix ./pkg/... ./cmd/...

lint_docker: ## Run docker instance of linting across the code base
${DOCKER} run --rm -v $(PWD):/app -v ~/.cache/golangci-lint/v1.64.8:/root/.cache -w /app golangci/golangci-lint:v1.64.8 golangci-lint run ./pkg/... ./cmd/...
${DOCKER} run --rm -v $(PWD):/app -v ~/.cache/golangci-lint/$(LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(LINT_VERSION) golangci-lint run ./pkg/... ./cmd/...

lint_docker_fix: ## Run docker instance of linting across the code base including auto-fixing
${DOCKER} run --rm -v $(PWD):/app -v ~/.cache/golangci-lint/$(LINT_VERSION):/root/.cache -w /app golangci/golangci-lint:$(LINT_VERSION) golangci-lint run --fix ./pkg/... ./cmd/...

run_local: ## Launch the API locally for test
@echo "Launching API locally..."
Expand Down Expand Up @@ -97,12 +102,17 @@ ghcr_push: ## Push the GH container image to GH Packages

ghcr_all: ghcr_build ghcr_tag ghcr_push ## Execute all GitHub Package container actions

build_amd: version ## Build an AMD 64 binary
build_local: version ## Build a Local binary
@echo "Building AMD binary $(VERSION)..."
go generate ./pkg/cmd/server.go
CGO_ENABLED=0 go build -ldflags="-w -s" -o ./target/scanoss-go-api-local ./cmd/server

build_amd: version ## Build a Linux AMD 64 binary
@echo "Building AMD binary $(VERSION)..."
go generate ./pkg/cmd/server.go
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./target/scanoss-go-api-linux-amd64 ./cmd/server

build_arm: version ## Build an ARM 64 binary
build_arm: version ## Build a Linux ARM 64 binary
@echo "Building ARM binary $(VERSION)..."
go generate ./pkg/cmd/server.go
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -ldflags="-w -s" -o ./target/scanoss-go-api-linux-arm64 ./cmd/server
Expand Down
2 changes: 1 addition & 1 deletion config/app-config-prod.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"LoadKbDetails": true,
"RankingAllowed": true,
"RankingEnabled": false,
"MatchConfigAllowed": false,
"MatchConfigAllowed": true,
"RankingThreshold": 0,
"MinSnippetHits": 0,
"MinSnippetLines": 0,
Expand Down
37 changes: 18 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module scanoss.com/go-api

go 1.24.4
go 1.25.0

require (
github.com/go-co-op/gocron v1.37.0
github.com/golobby/config/v3 v3.4.2
github.com/google/uuid v1.6.0
github.com/gorilla/mux v1.8.1
github.com/hashicorp/go-version v1.8.0
github.com/jpillora/ipfilter v1.2.9
github.com/jpillora/ipfilter v1.3.0
github.com/scanoss/zap-logging-helper v0.4.0
github.com/stretchr/testify v1.11.1
github.com/wlynxg/chardet v1.0.4
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.64.0
go.opentelemetry.io/otel v1.39.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.39.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.39.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.39.0
go.opentelemetry.io/otel/metric v1.39.0
go.opentelemetry.io/otel/sdk v1.39.0
go.opentelemetry.io/otel/sdk/metric v1.39.0
go.opentelemetry.io/otel/trace v1.39.0
go.opentelemetry.io/contrib/instrumentation/github.com/gorilla/mux/otelmux v0.67.0
go.opentelemetry.io/otel v1.42.0
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.42.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.42.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.42.0
go.opentelemetry.io/otel/metric v1.42.0
go.opentelemetry.io/otel/sdk v1.42.0
go.opentelemetry.io/otel/sdk/metric v1.42.0
go.opentelemetry.io/otel/trace v1.42.0
go.uber.org/zap v1.27.1
)

Expand All @@ -35,21 +35,20 @@ require (
github.com/golobby/cast v1.3.3 // indirect
github.com/golobby/dotenv v1.3.2 // indirect
github.com/golobby/env/v2 v2.2.4 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.4 // indirect
github.com/phuslu/iploc v1.0.20260115 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.28.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/tomasen/realip v0.0.0-20180522021738-f0c99a92ddce // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/proto/otlp v1.9.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.39.0 // indirect
golang.org/x/text v0.32.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260114163908-3f89685c29c3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260114163908-3f89685c29c3 // indirect
google.golang.org/grpc v1.78.0 // indirect
golang.org/x/net v0.51.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/text v0.34.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260209200024-4cfbd4190f57 // indirect
google.golang.org/grpc v1.79.2 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading