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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
cache: true
go-version-file: "go.mod"
Expand All @@ -44,7 +44,7 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Run build
run: make build
24 changes: 15 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
linters:
disable-all: true
enable:
- deadcode
- goconst
- gofmt
- revive
Expand All @@ -10,23 +9,18 @@ linters:
- misspell
- staticcheck
- unconvert
- varcheck
- vet
- vetshadow
- errcheck
- govet
- structcheck
- typecheck
- gocritic
- unused
- gci

run:

# timeout for analysis
timeout: 5m

skip-dirs:
- hack

linters-settings:
revive:
rules:
Expand All @@ -39,8 +33,19 @@ linters-settings:
disabled-checks:
- commentFormatting # we dont want to enforce space before the comment text

issues:
gci:
sections:
- standard
- prefix(github.com/v3io/sidecar-proxy)
- default
- blank
- dot

custom-order: true

issues:
exclude-dirs:
- hack
# List of regexps of issue texts to exclude
exclude:
- "comment on"
Expand All @@ -52,3 +57,4 @@ issues:
- path: _test\.go
linters:
- goconst
version: 2
48 changes: 39 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
LABEL ?= unstable
REPOSITORY ?= gcr.io/iguazio
IMAGE = $(REPOSITORY)/sidecar-proxy:$(LABEL)
GOPATH ?= $(shell go env GOPATH)

.PHONY: build
build:
Expand All @@ -13,15 +14,44 @@ build:
push:
docker push $(IMAGE)

.PHONY: lint
lint:
./hack/lint/install.sh
./hack/lint/run.sh

.PHONY: fmt
fmt:
@go fmt $(shell go list ./... | grep -v /vendor/)

.PHONY: test
test:
go test -p1 -v ./pkg/...

GOLANGCI_LINT_VERSION := v1.64.6
GOLANGCI_LINT_BIN := $(GOPATH)/bin/golangci-lint
GOLANGCI_LINT_INSTALL_COMMAND := GOBIN=$(GOPATH)/bin go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)

.PHONY: ensure-golangci-linter
ensure-golangci-linter:
@if ! command -v $(GOLANGCI_LINT_BIN) >/dev/null 2>&1; then \
echo "golangci-lint not found. Installing..."; \
$(GOLANGCI_LINT_INSTALL_COMMAND); \
else \
installed_version=$$($(GOLANGCI_LINT_BIN) version | awk '/version/ {print $$4}'); \
if [ "$$installed_version" != "$(GOLANGCI_LINT_VERSION)" ]; then \
echo "golangci-lint version mismatch ($$installed_version != $(GOLANGCI_LINT_VERSION)). Reinstalling..."; \
$(GOLANGCI_LINT_INSTALL_COMMAND); \
fi \
fi

.PHONY: ensure-gopath
ensure-gopath:
ifndef GOPATH
$(error GOPATH must be set)
endif

.PHONY: modules
modules: ensure-gopath
@go mod download

.PHONY: fmt
fmt: ensure-golangci-linter
gofmt -s -w .
$(GOPATH)/bin/golangci-lint run --fix

.PHONY: lint
lint: modules ensure-golangci-linter
@echo Linting...
$(GOPATH)/bin/golangci-lint run -v
@echo Done.
2 changes: 1 addition & 1 deletion cmd/sidecarproxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
FROM gcr.io/iguazio/golang:1.19 as builder
FROM gcr.io/iguazio/golang:1.23 as builder

# copy source tree
WORKDIR /sidecar-proxy
Expand Down
21 changes: 10 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
module github.com/v3io/sidecar-proxy

go 1.19
go 1.23

require (
github.com/nuclio/errors v0.0.4
github.com/nuclio/logger v0.0.1
github.com/nuclio/loggerus v0.0.6
github.com/prometheus/client_golang v1.14.0
github.com/sirupsen/logrus v1.9.0
github.com/prometheus/client_golang v1.22.0
github.com/sirupsen/logrus v1.9.3
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/logrusorgru/aurora/v3 v3.0.0 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
golang.org/x/sys v0.4.0 // indirect
google.golang.org/protobuf v1.33.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.62.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
golang.org/x/sys v0.30.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
)
Loading