Skip to content

Commit 0f097bf

Browse files
authored
Promote to FSC dependency to v0.13.0 (#1804)
Signed-off-by: AkramBitar <akram@il.ibm.com> Signed-off-by: Angelo De Caro <adc@zurich.ibm.com>
1 parent fe6632c commit 0f097bf

42 files changed

Lines changed: 3057 additions & 887 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/gofix.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/golangci-lint.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

.github/workflows/tests.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ jobs:
4646
- name: Run checks
4747
run: make checks
4848

49+
- name: Run linter
50+
run: make lint
51+
4952
utest:
5053
needs: checks
5154
runs-on: ubuntu-latest

Makefile

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ TOP = .
1818

1919
# include the checks target
2020
include $(TOP)/checks.mk
21+
22+
# Define all Go module directories
23+
GO_MODULES := . integration token/services/storage/db/kvs/hashicorp cmd/artifactgen cmd/tokengen cmd/token_validation_service cmd/profiler
24+
TIDY_GO_MODULES := $(GO_MODULES) tools
25+
2126
# include fabricx target
2227
include $(TOP)/fabricx.mk
2328
# include the interop target
@@ -117,12 +122,11 @@ integration-tests-dvp-dlog:
117122
.PHONY: tidy
118123
# tidy up go modules
119124
tidy:
120-
@go mod tidy
121-
cd tools; go mod tidy
122-
cd token/services/storage/db/kvs/hashicorp; go mod tidy
123-
cd cmd/artifactgen; go mod tidy
124-
cd cmd/tokengen; go mod tidy
125-
cd cmd/token_validation_service; go mod tidy
125+
@echo "Tidying Go modules..."
126+
@for dir in $(TIDY_GO_MODULES); do \
127+
echo " Tidying module: $$dir"; \
128+
(cd $$dir && go mod tidy); \
129+
done
126130

127131
.PHONY: clean
128132
# clean up docker artifacts and generated files
@@ -217,13 +221,19 @@ clean-all-containers:
217221
# run various linters
218222
lint:
219223
@echo "Running Go Linters..."
220-
golangci-lint run --color=always --timeout=4m
224+
@for dir in $(GO_MODULES); do \
225+
echo " Linting module: $$dir"; \
226+
(cd $$dir && golangci-lint run --color=always --timeout=4m ./...) || exit 1; \
227+
done
221228

222229
.PHONY: lint-auto-fix
223230
# run linters with auto-fix
224231
lint-auto-fix:
225232
@echo "Running Go Linters with auto-fix..."
226-
golangci-lint run --color=always --timeout=4m --fix
233+
@for dir in $(GO_MODULES); do \
234+
echo " Linting module: $$dir"; \
235+
(cd $$dir && golangci-lint run --color=always --timeout=4m --fix ./...) || exit 1; \
236+
done
227237

228238
.PHONY: install-linter-tool
229239
# install golangci-lint
@@ -234,7 +244,10 @@ install-linter-tool:
234244
.PHONY: fmt
235245
fmt: ## Run gofmt on the entire project
236246
@echo "Running gofmt..."
237-
@gofmt -l -s -w .
247+
@for dir in $(GO_MODULES); do \
248+
echo " Formatting module: $$dir"; \
249+
(cd $$dir && find . -path './.git' -prune -o -name '*.go' -print | xargs gofmt -l -s -w); \
250+
done
238251

239252
.PHONY: update-all-deps-latest
240253
update-all-deps-latest: ## Update all dependencies in all Go modules to their latest version

checks.mk

Lines changed: 86 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,110 @@
11
.PHONY: checks
2-
checks: licensecheck gofmt goimports govet misspell ineffassign staticcheck protos-lint buf-format
2+
checks: licensecheck gofmt goimports govet gofix misspell ineffassign staticcheck protos-lint buf-format
33

44
.PHONY: licensecheck
55
licensecheck:
66
@echo Running license check
7-
@find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs addlicense -check || (echo "Missing license headers"; exit 1)
7+
@for dir in $(GO_MODULES); do \
8+
echo " Checking licenses in module: $$dir"; \
9+
(cd $$dir && find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs addlicense -check) || (echo "Missing license headers in $$dir"; exit 1); \
10+
done
811

912
.PHONY: gofmt
1013
gofmt:
1114
@echo Running gofmt
12-
@{ \
13-
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs gofmt -l -s || true)"; \
14-
if [ -n "$$OUTPUT" ]; then \
15-
echo "The following gofmt issues were flagged:"; \
16-
echo "$$OUTPUT"; \
17-
echo "The gofmt command 'gofmt -l -s -w' must be run for these files"; \
18-
exit 1; \
19-
fi \
20-
}
15+
@for dir in $(GO_MODULES); do \
16+
echo " Checking format in module: $$dir"; \
17+
(cd $$dir && { \
18+
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs gofmt -l -s || true)"; \
19+
if [ -n "$$OUTPUT" ]; then \
20+
echo "The following gofmt issues were flagged in $$dir:"; \
21+
echo "$$OUTPUT"; \
22+
echo "The gofmt command 'gofmt -l -s -w' must be run for these files"; \
23+
exit 1; \
24+
fi; \
25+
}) || exit 1; \
26+
done
2127

2228
.PHONY: goimports
2329
goimports:
2430
@echo Running goimports
25-
@{ \
26-
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs goimports -l || true)"; \
27-
if [ -n "$$OUTPUT" ]; then \
28-
echo "The following files contain goimports errors"; \
29-
echo "$$OUTPUT"; \
30-
echo "The goimports command 'goimports -l -w' must be run for these files"; \
31-
exit 1; \
32-
fi \
33-
}
31+
@for dir in $(GO_MODULES); do \
32+
echo " Checking imports in module: $$dir"; \
33+
(cd $$dir && { \
34+
OUTPUT="$$(find . -path './.git' -prune -o -name '*.go' -not -name '*.pb.go' -print | xargs goimports -l || true)"; \
35+
if [ -n "$$OUTPUT" ]; then \
36+
echo "The following files contain goimports errors in $$dir:"; \
37+
echo "$$OUTPUT"; \
38+
echo "The goimports command 'goimports -l -w' must be run for these files"; \
39+
exit 1; \
40+
fi; \
41+
}) || exit 1; \
42+
done
3443

3544
.PHONY: govet
3645
govet:
3746
@echo Running go vet
38-
@go vet -all $(shell go list -f '{{.Dir}}' ./...) || (echo "Found some issues identified by 'go vet -all'. Please fix them!"; exit 1;)
47+
@for dir in $(GO_MODULES); do \
48+
echo " Checking module: $$dir"; \
49+
(cd $$dir && go vet -all $$(go list ./...)) || exit 1; \
50+
done
51+
52+
.PHONY: gofix
53+
gofix:
54+
@echo Running go fix
55+
@for dir in $(GO_MODULES); do \
56+
echo " Checking module: $$dir"; \
57+
(cd $$dir && { \
58+
OUTPUT="$$(go fix -diff ./... 2>&1 | grep -v '^go: warning:' | grep -v '^no packages to fix')"; \
59+
if [ -n "$$OUTPUT" ]; then \
60+
echo "go fix found modernization opportunities in $$dir:"; \
61+
echo "$$OUTPUT"; \
62+
echo ""; \
63+
echo "Run 'make gofix-apply' to apply these changes automatically."; \
64+
exit 1; \
65+
fi; \
66+
}) || exit 1; \
67+
done
68+
@echo "✓ No go fix suggestions - code is up to date."
69+
70+
.PHONY: gofix-apply
71+
gofix-apply:
72+
@echo Applying go fix to all modules
73+
@for dir in $(GO_MODULES); do \
74+
echo " Applying fixes to module: $$dir"; \
75+
(cd $$dir && go fix ./...); \
76+
done
77+
@echo "✓ go fix applied to all modules."
3978

4079
.PHONY: misspell
4180
misspell:
4281
@echo Running misspell
43-
@{ \
44-
OUTPUT="$$(find . -path './.git' -prune -o -type f -print | grep -v '.golangci.yml' | grep -v 'testdata' | xargs misspell || true)"; \
45-
if [ -n "$$OUTPUT" ]; then \
46-
echo "The following files are have spelling errors:"; \
47-
echo "$$OUTPUT"; \
48-
exit 1; \
49-
fi \
50-
}
82+
@for dir in $(GO_MODULES); do \
83+
echo " Checking spelling in module: $$dir"; \
84+
(cd $$dir && { \
85+
OUTPUT="$$(find . -path './.git' -prune -o -type f -print | grep -v '.golangci.yml' | grep -v 'testdata' | xargs misspell || true)"; \
86+
if [ -n "$$OUTPUT" ]; then \
87+
echo "The following files in $$dir have spelling errors:"; \
88+
echo "$$OUTPUT"; \
89+
exit 1; \
90+
fi; \
91+
}) || exit 1; \
92+
done
5193

5294
.PHONY: staticcheck
5395
staticcheck:
5496
@echo Running staticcheck
55-
@{ \
56-
OUTPUT="$$(staticcheck -tests=false ./... | grep -v .pb.go || true)"; \
57-
if [ -n "$$OUTPUT" ]; then \
58-
echo "The following staticcheck issues were flagged:"; \
59-
echo "$$OUTPUT"; \
60-
exit 1; \
61-
fi \
62-
}
97+
@for dir in $(GO_MODULES); do \
98+
echo " Checking module: $$dir"; \
99+
(cd $$dir && { \
100+
OUTPUT="$$(staticcheck -tests=false ./... | grep -v .pb.go || true)"; \
101+
if [ -n "$$OUTPUT" ]; then \
102+
echo "The following staticcheck issues were flagged in $$dir:"; \
103+
echo "$$OUTPUT"; \
104+
exit 1; \
105+
fi; \
106+
}) || exit 1; \
107+
done
63108

64109
.PHONY: gocyclo
65110
gocyclo:
@@ -69,7 +114,10 @@ gocyclo:
69114
.PHONY: ineffassign
70115
ineffassign:
71116
@echo Running ineffassign
72-
@ineffassign $(shell go list -f '{{.Dir}}' ./...)
117+
@for dir in $(GO_MODULES); do \
118+
echo " Checking module: $$dir"; \
119+
(cd $$dir && ineffassign $$(go list -f '{{.Dir}}' ./...)) || exit 1; \
120+
done
73121

74122
.PHONY: protos-lint
75123
protos-lint:

cmd/artifactgen/gen/gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type Topologies struct {
3131

3232
// T represents a list of topologies.
3333
type T struct {
34-
Topologies []interface{} `yaml:"topologies,omitempty"`
34+
Topologies []any `yaml:"topologies,omitempty"`
3535
}
3636

3737
var topologyFile string

0 commit comments

Comments
 (0)