Skip to content

Commit 011dda7

Browse files
authored
Merge pull request #70 from Nordix/bump_go_version
Bump go version and dependencies
2 parents b537b59 + 7761fe8 commit 011dda7

30 files changed

Lines changed: 843 additions & 827 deletions

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ bin/*
1212
# Output of the go coverage tool, specifically when used with LiteIDE
1313
*.out
1414

15+
# Test coverage files
16+
coverage_unit.html
17+
lcov.info
18+
func_coverage.out
19+
1520
# Dependency directories (remove the comment below to include it)
1621
# vendor/

.golangci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
version: 2
2+
13
run:
24
skip-dirs:
35
- vendor
@@ -11,18 +13,16 @@ linters:
1113
enable:
1214
# errcheck is a program for checking for unchecked errors in Go code. These unchecked errors can be critical bugs in some cases
1315
- errcheck
14-
# checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
15-
- gofmt
16-
# Linter for Go source code that specializes in simplifying code
17-
- gosimple
1816
# Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string
1917
- govet
2018
# Detects when assignments to existing variables are not used
2119
- ineffassign
22-
# Checks for misuse of Sprintf to construct a host with port in a URL.
23-
- nosprintfhostport
20+
# It's the set of rules from staticcheck (includes gosimple)
2421
- staticcheck
25-
# Like the front-end of a Go compiler, parses and type-checks Go code
26-
- typecheck
2722
# Checks Go code for unused constants, variables, functions and types
2823
- unused
24+
25+
formatters:
26+
enable:
27+
# checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification
28+
- gofmt

.prow.yaml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,40 @@ presubmits:
44
run_if_changed: "^.*.go$"
55
spec:
66
containers:
7-
- image: nephio/gotests:1783899289886396416
7+
- image: golang:1.25-alpine
88
command:
9-
- make
9+
- "/bin/sh"
10+
- "-c"
1011
args:
11-
- unit
12+
- |
13+
apk add --no-cache make bash
14+
make unit
1215
- name: presubmit-api-gosec
1316
decorate: true
1417
run_if_changed: "^.*.go$"
1518
spec:
1619
containers:
17-
- image: nephio/gotests:1783899289886396416
20+
- image: golang:1.25-alpine
1821
command:
19-
- make
22+
- "/bin/sh"
23+
- "-c"
2024
args:
21-
- gosec
25+
- |
26+
apk add --no-cache make bash git
27+
make gosec
2228
- name: presubmit-api-golangci-lint
2329
decorate: true
2430
run_if_changed: "^.*.go$"
2531
spec:
2632
containers:
27-
- image: nephio/gotests:1783899289886396416
33+
- image: golangci/golangci-lint:v2.8.0-alpine
2834
command:
29-
- make
35+
- "/bin/sh"
36+
- "-c"
3037
args:
31-
- lint
38+
- |
39+
apk add --no-cache make bash
40+
make lint
3241
- name: presubmit-api-license-header-check
3342
decorate: true
3443
run_if_changed: "^.*.go$"

Makefile

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
GO_VERSION ?= 1.20.2
16-
GOLANG_CI_VER ?= v1.52
17-
GOSEC_VER ?= 2.15.0
15+
GO_VERSION ?= 1.25
16+
GOLANG_CI_VER ?= v2.8.0
17+
GOSEC_VER ?= latest
1818
TEST_COVERAGE_FILE=lcov.info
1919
TEST_COVERAGE_HTML_FILE=coverage_unit.html
2020
TEST_COVERAGE_FUNC_FILE=func_coverage.out
@@ -78,16 +78,24 @@ $(LOCALBIN):
7878

7979
## Tool Binaries
8080
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
81+
GOSEC ?= $(LOCALBIN)/gosec
8182

8283
## Tool Versions
8384
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
84-
CONTROLLER_TOOLS_VERSION ?= v0.13.0
85+
CONTROLLER_TOOLS_VERSION ?= v0.20.0
86+
GOSEC_VERSION ?= latest
8587

8688
.PHONY: controller-gen
8789
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
8890
$(CONTROLLER_GEN): $(LOCALBIN)
8991
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
9092

93+
.PHONY: gosec
94+
gosec: $(GOSEC) ## inspects source code for security problem by scanning the Go Abstract Syntax Tree
95+
$(GOSEC) ./...
96+
$(GOSEC): $(LOCALBIN)
97+
test -s $(LOCALBIN)/gosec || GOBIN=$(LOCALBIN) go install github.com/securego/gosec/v2/cmd/gosec@$(GOSEC_VERSION)
98+
9199
.PHONY: unit_clean
92100
unit_clean: ## clean up the unit test artifacts created
93101
ifeq ($(CONTAINER_RUNNABLE), 0)
@@ -98,7 +106,7 @@ endif
98106
.PHONY: unit
99107
unit: ## Run unit tests against code.
100108
ifeq ($(CONTAINER_RUNNABLE), 0)
101-
$(CONTAINER_RUNTIME) run -it -v ${PWD}:/go/src -w /go/src docker.io/library/golang:${GO_VERSION}-alpine3.17 \
109+
$(CONTAINER_RUNTIME) run -it -v ${PWD}:/go/src -w /go/src docker.io/library/golang:${GO_VERSION}-alpine \
102110
/bin/sh -c "go test ./... -v -coverprofile ${TEST_COVERAGE_FILE}; \
103111
go tool cover -html=${TEST_COVERAGE_FILE} -o ${TEST_COVERAGE_HTML_FILE}; \
104112
go tool cover -func=${TEST_COVERAGE_FILE} -o ${TEST_COVERAGE_FUNC_FILE}"
@@ -116,12 +124,3 @@ ifeq ($(CONTAINER_RUNNABLE), 0)
116124
else
117125
golangci-lint run ./... -v --timeout 10m
118126
endif
119-
120-
# Install link at https://github.com/securego/gosec#install if not running inside a container
121-
.PHONY: gosec
122-
gosec: ## inspects source code for security problem by scanning the Go Abstract Syntax Tree
123-
ifeq ($(CONTAINER_RUNNABLE), 0)
124-
$(CONTAINER_RUNTIME) run -it -v ${PWD}:/go/src -w /go/src docker.io/securego/gosec:${GOSEC_VER} ./...
125-
else
126-
gosec ./...
127-
endif

cfg/v1alpha1/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/config.nephio.org_networks.yaml

Lines changed: 34 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.2
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.20.0
87
name: networks.config.nephio.org
98
spec:
109
group: config.nephio.org
@@ -28,14 +27,19 @@ spec:
2827
description: Network is the Schema for the Network API
2928
properties:
3029
apiVersion:
31-
description: 'APIVersion defines the versioned schema of this representation
32-
of an object. Servers should convert recognized schemas to the latest
33-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
30+
description: |-
31+
APIVersion defines the versioned schema of this representation of an object.
32+
Servers should convert recognized schemas to the latest internal value, and
33+
may reject unrecognized values.
34+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
3435
type: string
3536
kind:
36-
description: 'Kind is a string value representing the REST resource this
37-
object represents. Servers may infer this from the endpoint the client
38-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
37+
description: |-
38+
Kind is a string value representing the REST resource this object represents.
39+
Servers may infer this from the endpoint the client submits requests to.
40+
Cannot be updated.
41+
In CamelCase.
42+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3943
type: string
4044
metadata:
4145
type: object
@@ -48,14 +52,16 @@ spec:
4852
type: object
4953
x-kubernetes-preserve-unknown-fields: true
5054
lifecycle:
51-
description: Lifecycle determines the lifecycle policies the resource
52-
e.g. delete is orphan or delete will follow
55+
description: |-
56+
Lifecycle determines the lifecycle policies the resource e.g. delete is orphan or delete
57+
will follow
5358
properties:
5459
deletionPolicy:
5560
default: delete
56-
description: DeletionPolicy specifies what will happen to the
57-
underlying resource when this resource is deleted - either "delete"
58-
or "orphan" the resource.
61+
description: |-
62+
DeletionPolicy specifies what will happen to the underlying resource
63+
when this resource is deleted - either "delete" or "orphan" the
64+
resource.
5965
enum:
6066
- delete
6167
- orphan
@@ -70,32 +76,31 @@ spec:
7076
items:
7177
properties:
7278
lastTransitionTime:
73-
description: lastTransitionTime is the last time the condition
74-
transitioned from one status to another. This should be when
75-
the underlying condition changed. If that is not known, then
76-
using the time when the API field changed is acceptable.
79+
description: |-
80+
lastTransitionTime is the last time the condition transitioned from one status to another.
81+
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
7782
format: date-time
7883
type: string
7984
message:
80-
description: message is a human readable message indicating
81-
details about the transition. This may be an empty string.
85+
description: |-
86+
message is a human readable message indicating details about the transition.
87+
This may be an empty string.
8288
maxLength: 32768
8389
type: string
8490
observedGeneration:
85-
description: observedGeneration represents the .metadata.generation
86-
that the condition was set based upon. For instance, if .metadata.generation
87-
is currently 12, but the .status.conditions[x].observedGeneration
88-
is 9, the condition is out of date with respect to the current
89-
state of the instance.
91+
description: |-
92+
observedGeneration represents the .metadata.generation that the condition was set based upon.
93+
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
94+
with respect to the current state of the instance.
9095
format: int64
9196
minimum: 0
9297
type: integer
9398
reason:
94-
description: reason contains a programmatic identifier indicating
95-
the reason for the condition's last transition. Producers
96-
of specific condition types may define expected values and
97-
meanings for this field, and whether the values are considered
98-
a guaranteed API. The value should be a CamelCase string.
99+
description: |-
100+
reason contains a programmatic identifier indicating the reason for the condition's last transition.
101+
Producers of specific condition types may define expected values and meanings for this field,
102+
and whether the values are considered a guaranteed API.
103+
The value should be a CamelCase string.
99104
This field may not be empty.
100105
maxLength: 1024
101106
minLength: 1
@@ -110,10 +115,6 @@ spec:
110115
type: string
111116
type:
112117
description: type of condition in CamelCase or in foo.example.com/CamelCase.
113-
--- Many .condition.type values are consistent across resources
114-
like Available, but because arbitrary conditions can be useful
115-
(see .node.status.conditions), the ability to deconflict is
116-
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
117118
maxLength: 316
118119
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
119120
type: string

config/crd/bases/infra.nephio.org_clustercontexts.yaml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
33
kind: CustomResourceDefinition
44
metadata:
55
annotations:
6-
controller-gen.kubebuilder.io/version: v0.9.2
7-
creationTimestamp: null
6+
controller-gen.kubebuilder.io/version: v0.20.0
87
name: clustercontexts.infra.nephio.org
98
spec:
109
group: infra.nephio.org
@@ -21,14 +20,19 @@ spec:
2120
description: ClusterContext is the Schema for the clustercontexts API
2221
properties:
2322
apiVersion:
24-
description: 'APIVersion defines the versioned schema of this representation
25-
of an object. Servers should convert recognized schemas to the latest
26-
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
23+
description: |-
24+
APIVersion defines the versioned schema of this representation of an object.
25+
Servers should convert recognized schemas to the latest internal value, and
26+
may reject unrecognized values.
27+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
2728
type: string
2829
kind:
29-
description: 'Kind is a string value representing the REST resource this
30-
object represents. Servers may infer this from the endpoint the client
31-
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
30+
description: |-
31+
Kind is a string value representing the REST resource this object represents.
32+
Servers may infer this from the endpoint the client submits requests to.
33+
Cannot be updated.
34+
In CamelCase.
35+
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
3236
type: string
3337
metadata:
3438
type: object

0 commit comments

Comments
 (0)