Skip to content

Commit 4674dc1

Browse files
authored
Merge pull request #173 from eclipse-iofog/chore/16048-remove-vendor
Remove vendor node modules from iofogctl [sc-16048]
2 parents bc4d938 + 17f4e46 commit 4674dc1

File tree

3,435 files changed

+168
-1107222
lines changed

Some content is hidden

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

3,435 files changed

+168
-1107222
lines changed

.golangci.yaml

Lines changed: 149 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,121 @@
1+
2+
linters:
3+
# please, do not use `enable-all`: it's deprecated and will be removed soon.
4+
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
5+
disable-all: true
6+
enable:
7+
# - asasalint
8+
- asciicheck
9+
# - bidichk
10+
# - bodyclose
11+
# - contextcheck
12+
# - cyclop
13+
# - decorder
14+
- depguard
15+
- dogsled
16+
# - durationcheck
17+
# - errcheck
18+
# - errchkjson
19+
# - errname
20+
# - execinquery
21+
# - exportloopref
22+
# - forbidigo
23+
# - forcetypeassert
24+
- funlen
25+
# - revive
26+
- typecheck
27+
# - dupl
28+
# - dupword
29+
# - errorlint
30+
# - exhaustruct
31+
# - gochecknoglobals
32+
# - gochecknoinits
33+
# - gocognit
34+
- goconst
35+
# - gocritic # probably should re-enable this
36+
- gocyclo
37+
# - godot
38+
# - godox # disabling because we have WAY too many TODOs etc.
39+
# - goerr113 # TODO: reenable
40+
# - gofmt
41+
# - gofumpt # not using this
42+
- goheader
43+
# - goimports
44+
# - gomnd
45+
# - gomoddirectives
46+
# - gomodguard
47+
# - goprintffuncname
48+
# - gosec
49+
# - gosimple
50+
# - govet
51+
# - grouper
52+
# - ifshort
53+
# - importas
54+
# - ineffassign
55+
# - interfacebloat
56+
# - interfacer
57+
# - ireturn
58+
# - lll
59+
# - loggercheck
60+
# - maintidx
61+
# - makezero
62+
# - maligned
63+
# - misspell
64+
# - nakedret
65+
# - nestif
66+
# - nilerr
67+
# - nilnil
68+
# - nlreturn
69+
# - noctx
70+
# - nolintlint
71+
# - nonamedreturns
72+
# - nosnakecase
73+
# - nosprintfhostport
74+
# - paralleltest
75+
# - prealloc
76+
# - predeclared
77+
# - promlinter
78+
# - reassign
79+
# - rowserrcheck
80+
# - scopelint
81+
# - sqlclosecheck
82+
# - staticcheck
83+
# - structcheck
84+
# - stylecheck
85+
# - tagliatelle
86+
# - tenv
87+
# - testableexamples
88+
# - testpackage
89+
# - thelper
90+
# - tparallel
91+
# - unconvert
92+
# - unparam
93+
# - unused
94+
# - usestdlibvars
95+
# - varcheck
96+
# - varnamelen
97+
# - wastedassign
98+
# - whitespace
99+
# - wrapcheck
100+
# - wsl
101+
102+
1103
linters-settings:
104+
cyclop:
105+
max-complexity: 30
106+
skip-tests: true
2107
depguard:
3108
list-type: blacklist
4109
packages:
5-
# logging is allowed only by logutils.Log, logrus
6-
# is allowed to use only in logutils package
7-
# - github.com/sirupsen/logrus
110+
# logging is allowed only by logutils.Log, logrus
111+
# is allowed to use only in logutils package
112+
# - github.com/sirupsen/logrus
8113
packages-with-error-message:
9-
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
114+
# - github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
10115
dupl:
11116
threshold: 100
12117
funlen:
13-
lines: 200
118+
lines: 250
14119
statements: 100
15120
goconst:
16121
min-len: 2
@@ -33,10 +138,28 @@ linters-settings:
33138
min-complexity: 36
34139
gocyclo:
35140
min-complexity: 36
141+
godox:
142+
# Report any comments starting with keywords, this is useful for TODO or FIXME comments that
143+
# might be left in the code accidentally and should be resolved before merging.
144+
# Default: ["TODO", "BUG", "FIXME"]
145+
keywords:
146+
- TODO
147+
- BUG
148+
- FIXME
149+
gofmt:
150+
# Simplify code: gofmt with `-s` option.
151+
# Default: true
152+
simplify: true
153+
# Apply the rewrite rules to the source before reformatting.
154+
# https://pkg.go.dev/cmd/gofmt
155+
# Default: []
156+
rewrite-rules:
157+
- pattern: 'interface{}'
158+
replacement: 'any'
159+
- pattern: 'a[b:len(a)]'
160+
replacement: 'a[b:]'
36161
goimports:
37-
# local-prefixes: github.com/golangci/golangci-lint
38-
golint:
39-
min-confidence: 0
162+
# local-prefixes: github.com/golangci/golangci-lint
40163
gomnd:
41164
settings:
42165
mnd:
@@ -53,52 +176,18 @@ linters-settings:
53176
suggest-new: true
54177
misspell:
55178
locale: US
179+
nestif:
180+
min-complexity: 10
56181

57-
linters:
58-
# please, do not use `enable-all`: it's deprecated and will be removed soon.
59-
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
60-
disable-all: true
61-
enable:
62-
- bodyclose
63-
- deadcode
64-
- depguard
65-
- dogsled
66-
# - dupl
67-
- errcheck
68-
- funlen
69-
# - gochecknoinits
70-
- goconst
71-
- gocritic
72-
- gocyclo
73-
- gofmt
74-
- goimports
75-
- golint
76-
# - gomnd
77-
- goprintffuncname
78-
# - gosec
79-
- gosimple
80-
- govet
81-
- ineffassign
82-
- interfacer
83-
- lll
84-
# - misspell
85-
- nakedret
86-
- rowserrcheck
87-
- scopelint
88-
- staticcheck
89-
- structcheck
90-
- stylecheck
91-
- typecheck
92-
- unconvert
93-
- unparam
94-
- unused
95-
- varcheck
96-
- whitespace
97-
# - gochecknoglobals
98-
- gocognit
99-
# - godox
100-
# - maligned
101-
- prealloc
182+
varnamelen:
183+
# The longest distance, in source lines, that is being considered a "small scope".
184+
# Variables used in at most this many lines will be ignored.
185+
# Default: 5
186+
max-distance: 50
187+
# The minimum length of a variable's name that is considered "long".
188+
# Variable names that are at least this long will be ignored.
189+
# Default: 3
190+
min-name-length: 2
102191

103192
issues:
104193
# Excluding configuration per-path, per-linter, per-text and per-source
@@ -112,22 +201,19 @@ issues:
112201
- dupl
113202
- funlen
114203

115-
- linters:
116-
- gosec
117-
text: "G[202]"
118-
text: "G[101]"
119-
120-
121204
run:
122205
skip-files:
123-
- ".*_test.go"
124-
- ".*rice-box.*"
125-
modules-download-mode: vendor
206+
# auto-generated
207+
- ".*_test.go"
208+
209+
210+
126211

127212
# golangci.com configuration
128213
# https://github.com/golangci/golangci/wiki/Configuration
129214
service:
130-
golangci-lint-version: 1.31.x # use the fixed version to not introduce new linters unexpectedly
215+
golangci-lint-version: 1.50.1 # use the fixed version to not introduce new linters unexpectedly
131216
prepare:
132217
- echo "here I can run custom commands, but no preparation needed for this repo"
133218

219+

Makefile

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ REPORTS_DIR ?= reports
3333
TEST_RESULTS ?= TEST-iofogctl.txt
3434
TEST_REPORT ?= TEST-iofogctl.xml
3535

36-
# Go variables
37-
export CGO_ENABLED ?= 0
38-
export GOOS ?= $(OS)
39-
export GOARCH ?= amd64
40-
GOFILES_NOVENDOR = $(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./client/*")
41-
4236
.PHONY: all
4337
all: bootstrap build install ## Bootstrap env, build and install binary
4438

@@ -48,7 +42,7 @@ bootstrap: ## Bootstrap environment
4842
@script/bootstrap.sh
4943

5044
.PHONY: build
51-
build: GOARGS += -mod=vendor -tags "$(GOTAGS)" -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)
45+
build: GOARGS += -tags "$(GOTAGS)" -ldflags "$(LDFLAGS)" -o $(BUILD_DIR)/$(BINARY_NAME)
5246
build: fmt ## Build the binary
5347
@cd pkg/util && rice embed-go
5448
@go build -v $(GOARGS) $(PACKAGE_DIR)/main.go
@@ -57,37 +51,30 @@ build: fmt ## Build the binary
5751
install: ## Install the iofogctl binary to /usr/local/bin
5852
@sudo cp $(BUILD_DIR)/$(BINARY_NAME) /usr/local/bin
5953

60-
.PHONY: modules
61-
modules: ## Get modules
62-
@for module in $(OPERATOR_MODULE) $(GO_SDK_MODULE) ; do \
63-
go get github.com/eclipse-iofog/$$module; \
64-
done
65-
@go get github.com/eclipse-iofog/[email protected]
66-
67-
.PHONY: get
68-
get: export GOFLAGS=-mod=vendor
69-
get: ## Pull modules
70-
71-
.PHONY: vendor
72-
vendor: modules ## Vendor all modules
73-
@go mod vendor
74-
@for module in GeertJohan; do \
75-
git checkout -- vendor/github.com/$$module; \
76-
done
77-
7854
.PHONY: lint
79-
lint: fmt ## Lint the source
80-
@golangci-lint run --timeout 5m0s
55+
lint: golangci-lint fmt ## Lint the source
56+
@$(GOLANGCI_LINT) run --timeout 5m0s
57+
58+
golangci-lint: ## Install golangci
59+
ifeq (, $(shell which golangci-lint))
60+
@{ \
61+
set -e ;\
62+
go install github.com/golangci/golangci-lint/cmd/[email protected] ;\
63+
}
64+
GOLANGCI_LINT=$(GOBIN)/golangci-lint
65+
else
66+
GOLANGCI_LINT=$(shell which golangci-lint)
67+
endif
8168

8269
.PHONY: fmt
8370
fmt: ## Format the source
84-
@gofmt -s -w $(GOFILES_NOVENDOR)
71+
@gofmt -s -w .
8572

8673
.PHONY: test
8774
test: ## Run unit tests
8875
mkdir -p $(REPORTS_DIR)
8976
rm -f $(REPORTS_DIR)/*
90-
set -o pipefail; find ./internal ./pkg -name '*_test.go' -not -path vendor | sed -E "s|(/.*/).*_test.go|\1|g" | xargs -n1 go test -mod=vendor -ldflags "$(LDFLAGS)" -coverprofile=$(REPORTS_DIR)/coverage.txt -v -parallel 1 2>&1 | tee $(REPORTS_DIR)/$(TEST_RESULTS)
77+
set -o pipefail; find ./internal ./pkg -name '*_test.go' -not -path vendor | sed -E "s|(/.*/).*_test.go|\1|g" | xargs -n1 go test -ldflags "$(LDFLAGS)" -coverprofile=$(REPORTS_DIR)/coverage.txt -v -parallel 1 2>&1 | tee $(REPORTS_DIR)/$(TEST_RESULTS)
9178
cat $(REPORTS_DIR)/$(TEST_RESULTS) | go-junit-report -set-exit-code > $(REPORTS_DIR)/$(TEST_REPORT)
9279

9380
.PHONY: list

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/json-iterator/go v1.1.12
1313
github.com/mitchellh/go-homedir v1.1.0
1414
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
15-
github.com/spf13/cobra v1.4.0
15+
github.com/spf13/cobra v1.5.0
1616
github.com/twmb/algoimpl v0.0.0-20170717182524-076353e90b94
1717
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
1818
gopkg.in/yaml.v2 v2.4.0

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,9 @@ github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkU
630630
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
631631
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
632632
github.com/spf13/cobra v1.1.3/go.mod h1:pGADOWyqRD/YMrPZigI/zbliZ2wVD/23d+is3pSWzOo=
633-
github.com/spf13/cobra v1.4.0 h1:y+wJpx64xcgO1V+RcnwW0LEHxTKRi2ZDPSBjWnrg88Q=
634633
github.com/spf13/cobra v1.4.0/go.mod h1:Wo4iy3BUC+X2Fybo0PDqwJIv3dNRiZLHQymsfxlB84g=
634+
github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
635+
github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
635636
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
636637
github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
637638
github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=

0 commit comments

Comments
 (0)