move gofumpt to golang-ci

This commit is contained in:
Minio Trusted 2022-01-06 13:08:21 -08:00
parent 3d66d053c7
commit 76877eb6fa
6 changed files with 34 additions and 17 deletions

View File

@ -24,6 +24,15 @@ linters:
- unconvert - unconvert
- varcheck - varcheck
- gocritic - gocritic
- gofumpt
linters-settings:
gofumpt:
lang-version: "1.17"
# Choose whether or not to use the extra rules that are disabled
# by default
extra-rules: false
issues: issues:
exclude-use-default: false exclude-use-default: false

View File

@ -20,7 +20,6 @@ help: ## print this help
getdeps: ## fetch necessary dependencies getdeps: ## fetch necessary dependencies
@mkdir -p ${GOPATH}/bin @mkdir -p ${GOPATH}/bin
@echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0 @echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.43.0
@echo "Installing gofumpt" && go install mvdan.cc/gofumpt@latest
@echo "Installing msgp" && go install -v github.com/tinylib/msgp@v1.1.7-0.20211026165309-e818a1881b0e @echo "Installing msgp" && go install -v github.com/tinylib/msgp@v1.1.7-0.20211026165309-e818a1881b0e
@echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@latest @echo "Installing stringer" && go install -v golang.org/x/tools/cmd/stringer@latest
@ -37,7 +36,6 @@ lint: ## runs golangci-lint suite of linters
@echo "Running $@ check" @echo "Running $@ check"
@${GOPATH}/bin/golangci-lint cache clean @${GOPATH}/bin/golangci-lint cache clean
@${GOPATH}/bin/golangci-lint run --build-tags kqueue --timeout=10m --config ./.golangci.yml @${GOPATH}/bin/golangci-lint run --build-tags kqueue --timeout=10m --config ./.golangci.yml
@${GOPATH}/bin/gofumpt -l .
check: test check: test
test: verifiers build ## builds minio, runs linters, tests test: verifiers build ## builds minio, runs linters, tests

View File

@ -332,8 +332,10 @@ func (sys *BucketTargetSys) set(bucket BucketInfo, meta BucketMetadata) {
} }
// getRemoteTargetInstanceTransport contains a singleton roundtripper. // getRemoteTargetInstanceTransport contains a singleton roundtripper.
var getRemoteTargetInstanceTransport http.RoundTripper var (
var getRemoteTargetInstanceTransportOnce sync.Once getRemoteTargetInstanceTransport http.RoundTripper
getRemoteTargetInstanceTransportOnce sync.Once
)
// Returns a minio-go Client configured to access remote host described in replication target config. // Returns a minio-go Client configured to access remote host described in replication target config.
func (sys *BucketTargetSys) getRemoteTargetClient(tcfg *madmin.BucketTarget) (*TargetClient, error) { func (sys *BucketTargetSys) getRemoteTargetClient(tcfg *madmin.BucketTarget) (*TargetClient, error) {

View File

@ -256,8 +256,10 @@ const (
// Random number state. // Random number state.
// We generate random temporary file names so that there's a good // We generate random temporary file names so that there's a good
// chance the file doesn't exist yet. // chance the file doesn't exist yet.
var randN uint32 var (
var randmu sync.Mutex randN uint32
randmu sync.Mutex
)
// Temp files created in default Tmp dir // Temp files created in default Tmp dir
var globalTestTmpDir = os.TempDir() var globalTestTmpDir = os.TempDir()

View File

@ -406,8 +406,10 @@ type minioProfiler interface {
} }
// Global profiler to be used by service go-routine. // Global profiler to be used by service go-routine.
var globalProfiler map[string]minioProfiler var (
var globalProfilerMu sync.Mutex globalProfiler map[string]minioProfiler
globalProfilerMu sync.Mutex
)
// dump the request into a string in JSON format. // dump the request into a string in JSON format.
func dumpRequest(r *http.Request) string { func dumpRequest(r *http.Request) string {

View File

@ -32,14 +32,16 @@ type Target interface {
Send(entry interface{}, errKind string) error Send(entry interface{}, errKind string) error
} }
// swapMu must be held while reading slice info or swapping targets or auditTargets. var (
var swapMu sync.Mutex // swapMu must be held while reading slice info or swapping targets or auditTargets.
swapMu sync.Mutex
// targets is the set of enabled loggers. // targets is the set of enabled loggers.
// Must be immutable at all times. // Must be immutable at all times.
// Can be swapped to another while holding swapMu // Can be swapped to another while holding swapMu
var targets = []Target{} targets = []Target{}
var nTargets int32 // atomic count of len(targets) nTargets int32 // atomic count of len(targets)
)
// Targets returns active targets. // Targets returns active targets.
// Returned slice may not be modified in any way. // Returned slice may not be modified in any way.
@ -70,8 +72,10 @@ func AuditTargets() []Target {
// auditTargets is the list of enabled audit loggers // auditTargets is the list of enabled audit loggers
// Must be immutable at all times. // Must be immutable at all times.
// Can be swapped to another while holding swapMu // Can be swapped to another while holding swapMu
var auditTargets = []Target{} var (
var nAuditTargets int32 // atomic count of len(auditTargets) auditTargets = []Target{}
nAuditTargets int32 // atomic count of len(auditTargets)
)
// AddAuditTarget adds a new audit logger target to the // AddAuditTarget adds a new audit logger target to the
// list of enabled loggers // list of enabled loggers