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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 62 additions & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,74 @@
# See the License for the specific language governing permissions and
# limitations under the License.

version: "2"

run:
modules-download-mode: vendor
tests: false

linters:
enable:
#- gochecknoglobals
#- gochecknoinits
#- gocritic
- gofmt
#- gofmt
#- golint
#- unparam
- unparam

settings:
staticcheck:
# Keep the SA* correctness checks. Disable the stylecheck (ST*),
# quickfix (QF*) and a few gosimple (S*) checks that golangci-lint v2
# folded into staticcheck but that were not part of the linter set
# previously used by this repository. SA1019 (deprecations) is muted
# here and tracked separately.
checks:
- all
- -ST1003
- -ST1005
- -ST1008
- -ST1016
- -ST1023
- -QF1003
- -QF1007
- -QF1008
- -QF1010
- -QF1011
- -S1025
- -S1038
- -S1039
- -SA1006
- -SA1019

exclusions:
generated: lax
# test helper files are only consumed by _test.go files, which are not
# linted (run.tests: false); skip them to avoid false "unused" reports.
paths:
- _test_helpers\.go
# Restore the default exclusion presets that golangci-lint v1 enabled
# out of the box (errcheck on Close/print, legacy stylecheck comments, ...).
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
# protobuf messages embed a sync.Mutex via MessageState; copying them by
# value is standard practice with the generated code and safe here.
- linters:
- govet
text: "copylocks:"
# grpc status.Errorf and testing Fatalf are intentionally called with
# dynamic (non-constant) format strings.
- linters:
- govet
text: "non-constant format string"
- linters:
- govet
text: "redundant newline"
# unused/constant parameters in mocks and test helpers are expected.
- linters:
- unparam
text: "(always receives|is unused|is always nil|is never used)"
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ MAKECMDGOALS ?= help
##-------------------##
##---] GLOBALS [---##
##-------------------##
GO_CMD := go mod download
VOLTHA_PROTOS ?= /go/pkg/mod/github.com/opencord/voltha-protos/v5@$(shell go list -m -f '{{.Version}}' github.com/opencord/voltha-protos/v5)
GOOGLEAPI ?= /go/pkg/mod/github.com/grpc-ecosystem/grpc-gateway@$(shell go list -m -f '{{.Version}}' github.com/grpc-ecosystem/grpc-gateway)

# -----------------------------------------------------------------------
# 2024-04-10
Expand Down Expand Up @@ -162,8 +165,7 @@ sca:
@$(RM) -r $(sca-report-dir)
@mkdir -p $(sca-report-dir)
@echo "Running static code analysis..."
@${GOLANGCI_LINT} run -vv --deadline=6m --out-format junit-xml ./... \
| tee ./sca-report/sca-report.xml
@${GOLANGCI_LINT} run -vv --output.json.path=stdout ./... 2>&1 | tee ./sca-report/sca-report.xml
@echo ""
@echo "Static code analysis OK"
$(call begin-leave,Target $@)
Expand Down Expand Up @@ -359,7 +361,7 @@ api/openolt/openolt.pb.go: api/openolt/openolt.proto setup_tools
@echo $@
@${PROTOC} -I. \
-I${GOOGLEAPI}/third_party/googleapis \
--go_out=plugins=grpc:./ --go_opt=paths=source_relative \
--go_out=. --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative \
$<

## -----------------------------------------------------------------------
Expand All @@ -368,7 +370,7 @@ api/bbsim/bbsim_dmi.pb.go: api/bbsim/bbsim_dmi.proto setup_tools
@echo $@
@${PROTOC} -I. \
-I${GOOGLEAPI}/third_party/googleapis \
--go_out=plugins=grpc:./ --go_opt=paths=source_relative \
--go_out=. --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative \
$<

## -----------------------------------------------------------------------
Expand All @@ -378,7 +380,7 @@ api/bbsim/bbsim.pb.go api/bbsim/bbsim.pb.gw.go: api/bbsim/bbsim.proto api/bbsim/
@${PROTOC} -I. \
-I${GOOGLEAPI}/third_party/googleapis \
-I${VOLTHA_PROTOS}/protos/ \
--go_out=plugins=grpc:./ --go_opt=paths=source_relative \
--go_out=. --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative \
--grpc-gateway_out=logtostderr=true,paths=source_relative,grpc_api_configuration=api/bbsim/bbsim.yaml,allow_delete_body=true:./ \
$<

Expand All @@ -390,7 +392,7 @@ api/legacy/bbsim.pb.go api/legacy/bbsim.pb.gw.go: api/legacy/bbsim.proto setup_t
-I${GOOGLEAPI}/third_party/googleapis/ \
-I${GOOGLEAPI}/ \
-I${VOLTHA_PROTOS}/protos/ \
--go_out=plugins=grpc:./ \
--go_out=. --go-grpc_out=. --go-grpc_opt=paths=source_relative --go_opt=paths=source_relative \
--grpc-gateway_out=logtostderr=true,paths=source_relative,allow_delete_body=true:./ \
$<

Expand All @@ -401,7 +403,7 @@ docs/swagger/bbsim/bbsim.swagger.json: api/bbsim/bbsim.yaml setup_tools
@${PROTOC} -I ./api \
-I${GOOGLEAPI}/ \
-I${VOLTHA_PROTOS}/protos/ \
--swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true,grpc_api_configuration=$<:docs/swagger/ \
--swagger_out=logtostderr=true,simple_operation_ids=true,allow_delete_body=true,disable_default_errors=true,grpc_api_configuration=$<:docs/swagger/ \
api/bbsim/bbsim.proto

## -----------------------------------------------------------------------
Expand All @@ -411,7 +413,7 @@ docs/swagger/leagacy/bbsim.swagger.json: api/legacy/bbsim.proto setup_tools
@${PROTOC} -I ./api \
-I${GOOGLEAPI}/ \
-I${VOLTHA_PROTOS}/protos/ \
--swagger_out=logtostderr=true,allow_delete_body=true,disable_default_errors=true:docs/swagger/ \
--swagger_out=logtostderr=true,simple_operation_ids=true,allow_delete_body=true,disable_default_errors=true:docs/swagger/ \
$<

## -----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.8
1.17.1
Loading
Loading