Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated to match V1 #8

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
116 changes: 85 additions & 31 deletions .github/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
linters:
disable-all: true
enable:
- asasalint
- asciicheck
- bidichk
- bodyclose
- containedctx
- contextcheck
- cyclop
- deadcode
- decorder
- depguard
- dogsled
- dupl
- durationcheck
- errcheck
- errchkjson
- errname
- errorlint
- execinquery
- exhaustive
- exhaustruct
- exportloopref
- forbidigo
- forcetypeassert
- funlen
- gci
#- gochecknoglobals
#- gochecknoinits
- gocognit
- goconst
- gocritic
Expand All @@ -26,54 +38,58 @@ linters:
- gofumpt
- goheader
- goimports
- golint
- gomodguard
- gomnd
- gomoddirectives
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ifshort
- grouper
- importas
- ineffassign
- interfacebloat
- ireturn
- lll
- logrlint
- maintidx
- makezero
- maligned
- megacheck
- misspell
- nakedret
- nestif
- nilerr
- nilnil
- nlreturn
- noctx
- nolintlint
#- nonamedreturns
- nosprintfhostport
- paralleltest
- prealloc
- predeclared
- promlinter
- reassign
- revive
- rowserrcheck
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- tagliatelle
- tenv
#- testableexamples
- testpackage
- thelper
- tparallel
- typecheck
- unconvert
- unparam
- unused
- varcheck
- usestdlibvars
#- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
#- exhaustive
#- exhaustivestruct
#- gci
#- gochecknoglobals
#- gochecknoinits
#- gomnd
#- nlreturn
presets:
- bugs
- unused
Expand All @@ -85,9 +101,23 @@ linters-settings:
errcheck:
check-type-assertions: true
check-blank: true
#exclude-functions:
# - io/ioutil.ReadFile
# - io.Copy(*bytes.Buffer)
# - io.Copy(os.Stdout)
funlen:
lines: 100
statements: 50
gci:
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/bytemare/opaque) # Custom section: groups all imports with the specified Prefix.
skip-generated: true
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
gocognit:
min-complexity: 15
goconst:
Expand All @@ -103,7 +133,7 @@ linters-settings:
gocyclo:
min-complexity: 15
godox:
keywords: # default keywords are TODO, BUG, and FIXME, these can be overwritten by this setting
keywords:
- NOTE
- OPTIMIZE
- HACK
Expand All @@ -127,20 +157,44 @@ linters-settings:
- assign
govet:
check-shadowing: true

# settings per analyzer
settings:
printf: # analyzer name, run `go tool vet help` to see all analyzers
funcs: # run `go tool vet help printf` to see available settings for `printf` analyzer
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Infof
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Warnf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Errorf
- (github.com/golangci/golangci-lint/pkg/logutils.Log).Fatalf

# enable or disable analyzers by name
disable-all: true
enable:
- asmdecl
- assign
- atomic
- atomicalign
disable-all: false
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- fieldalignment
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
depguard:
list-type: blacklist
packages:
Expand All @@ -150,13 +204,13 @@ linters-settings:
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
lll:
line-length: 145
line-length: 120
# tab width ('\t') in spaces. Default to 1.
tab-width: 4
maligned:
suggest-new: true
misspell:
locale: US
nlreturn:
block-size: 2
prealloc:
simple: false
for-loops: true
Expand Down
49 changes: 49 additions & 0 deletions .github/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.PHONY: update
update:
@cd ../
@echo "Updating dependencies..."
@go get -u
@go mod tidy
@echo "Updating Github Actions pins..."
@$(foreach file, $(wildcard workflows/*.yml), pin-github-action $(file);)
@echo "Updating linters..."
@go install mvdan.cc/gofumpt@latest
@go install github.com/daixiang0/gci@latest
@go install github.com/segmentio/golines@latest
@go install golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin

.PHONY: fmt
fmt:
@echo "Formatting ..."
@go mod tidy
@go fmt ../...
@golines -m 120 -t 4 -w ../
@gofumpt -w -extra ../
@gci write --Section Standard --Section Default --Section "Prefix($(shell go list -m))" ../
@fieldalignment ../...

.PHONY: license
license:
@echo "Checking License headers ..."
@if addlicense -check -v -skip yaml -f licence-header.tmpl ../*; then echo "License headers OK"; else return 1; fi;

.PHONY: lint
lint: fmt license
@echo "Linting ..."
@if golangci-lint run --config=.golangci.yml ../...; then echo "Linting OK"; else return 1; fi;

.PHONY: test
test:
@echo "Running all tests ..."
@go test -v -vet=all ../...

.PHONY: vectors
vectors:
@echo "Testing vectors ..."
@go test -v ../...

.PHONY: cover
cover:
@echo "Testing with coverage ..."
@go test -v -race -covermode=atomic -coverpkg=../... -coverprofile=./coverage.out ../tests
15 changes: 15 additions & 0 deletions .github/node_modules/.package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .github/node_modules/lol/.npmignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions .github/node_modules/lol/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions .github/node_modules/lol/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions .github/node_modules/lol/lol.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.