Skip to content

Commit 24ed45d

Browse files
authored
[Go] Bump to 1.21 (#61)
1 parent 362f556 commit 24ed45d

File tree

7 files changed

+27
-32
lines changed

7 files changed

+27
-32
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@
1212

1313
# Output of the go coverage tool, specifically when used with LiteIDE
1414
*.out
15+
16+
.bin

.golangci.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,24 @@ linters:
3131
- govet
3232
- typecheck
3333
- gocritic
34+
- gci
3435

3536
run:
3637

3738
# timeout for analysis
3839
timeout: 5m
3940

41+
linters-settings:
42+
gci:
43+
sections:
44+
- standard
45+
- prefix(github.com/v3io/scaler)
46+
- default
47+
- blank
48+
- dot
49+
50+
custom-order: true
51+
4052
issues:
4153

4254
# List of regexps of issue texts to exclude

Makefile

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,31 +73,17 @@ GO_BUILD_TOOL_WORKDIR = /scaler
7373

7474
.PHONY: lint
7575
lint: modules
76-
@echo Installing linters...
77-
@test -e $(GOPATH)/bin/impi || \
78-
curl -s https://api.github.com/repos/pavius/impi/releases/latest \
79-
| grep -i "browser_download_url.*impi.*$(OS_NAME)" \
80-
| cut -d : -f 2,3 \
81-
| tr -d \" \
82-
| wget -O $(GOPATH)/bin/impi -qi -
83-
@test -e $(GOPATH)/bin/golangci-lint || \
84-
(curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.50.1)
85-
86-
@echo Verifying imports...
87-
chmod +x $(GOPATH)/bin/impi && $(GOPATH)/bin/impi \
88-
--local github.com/v3io/scaler/ \
89-
--scheme stdLocalThirdParty \
90-
--skip pkg/platform/kube/apis \
91-
--skip pkg/platform/kube/client \
92-
./cmd/... ./pkg/...
76+
@test -e .bin/golangci-lint || \
77+
(curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b .bin v1.55.1)
9378

9479
@echo Linting...
95-
$(GOPATH)/bin/golangci-lint run -v
80+
.bin/golangci-lint run -v
9681
@echo Done.
9782

9883
.PHONY: fmt
9984
fmt:
10085
gofmt -s -w .
86+
.bin/golangci-lint run --fix ./...
10187

10288
.PHONY: test-undockerized
10389
test-undockerized: modules
@@ -116,13 +102,8 @@ test:
116102
$(SCALER_DOCKER_TEST_TAG) \
117103
/bin/bash -c "make test-undockerized"
118104

119-
.PHONY: ensure-gopath
120-
ensure-gopath:
121-
ifndef GOPATH
122-
$(error GOPATH must be set)
123-
endif
124105

125106
.PHONY: modules
126-
modules: ensure-gopath
107+
modules:
127108
@echo Getting go modules
128109
@go mod download

cmd/autoscaler/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
#
1515

16-
FROM gcr.io/iguazio/golang:1.19-alpine3.17 AS builder
16+
FROM gcr.io/iguazio/golang:1.21-alpine3.18 AS builder
1717

1818
RUN apk --update --no-cache add \
1919
git \
@@ -30,6 +30,6 @@ COPY . .
3030

3131
RUN GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-s -w" -o autoscaler cmd/autoscaler/main.go
3232

33-
FROM gcr.io/iguazio/alpine:3.17
33+
FROM gcr.io/iguazio/alpine:3.18
3434

3535
COPY --from=builder /autoscaler/autoscaler /home/v3io/bin/autoscaler

cmd/dlx/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414
#
1515

16-
FROM gcr.io/iguazio/golang:1.19-alpine3.17 AS builder
16+
FROM gcr.io/iguazio/golang:1.21-alpine3.18 AS builder
1717

1818
RUN apk --update --no-cache add \
1919
git \
@@ -30,6 +30,6 @@ COPY . .
3030

3131
RUN GOOS=linux GOARCH=amd64 go build -a -installsuffix cgo -ldflags="-s -w" -o dlx cmd/dlx/main.go
3232

33-
FROM gcr.io/iguazio/alpine:3.17
33+
FROM gcr.io/iguazio/alpine:3.18
3434

3535
COPY --from=builder /dlx/dlx /home/v3io/bin/dlx

pkg/resourcescaler/mock/resourcescaler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ type ResourceScaler struct {
3232
mock.Mock
3333
}
3434

35-
func New(kubeconfigPath string, namespace string) (scalertypes.ResourceScaler, error) { // nolint: deadcode
35+
func New(_ string, _ string) (scalertypes.ResourceScaler, error) { // nolint: deadcode
3636
return &ResourceScaler{}, nil
3737
}
3838

pkg/resourcescaler/nop/resourcescaler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ import (
2828

2929
type ResourceScaler struct{}
3030

31-
func New(kubeconfigPath string, namespace string) (scalertypes.ResourceScaler, error) { // nolint: deadcode
31+
func New(_ string, _ string) (scalertypes.ResourceScaler, error) { // nolint: deadcode
3232
return &ResourceScaler{}, nil
3333
}
3434

35-
func (r *ResourceScaler) SetScale(resources []scalertypes.Resource, scale int) error {
35+
func (r *ResourceScaler) SetScale(_ []scalertypes.Resource, _ int) error {
3636
return nil
3737
}
3838

39-
func (r *ResourceScaler) SetScaleCtx(ctx context.Context, resources []scalertypes.Resource, scale int) error {
39+
func (r *ResourceScaler) SetScaleCtx(_ context.Context, _ []scalertypes.Resource, _ int) error {
4040
return nil
4141
}
4242

0 commit comments

Comments
 (0)