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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/go-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ jobs:
check-latest: true
cache: true

- name: Install golangci-lint (revive replaces golint)
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$(go env GOPATH)/bin" v2.4.0
golangci-lint version

- name: Build and test (Linux)
if: matrix.os == 'ubuntu-latest'
env:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/go-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
CGO_ENABLED: 0
GO111MODULE: on
run: |
sudo apt-get update -qq
sudo apt-get install -y jq
sudo sysctl net.ipv6.conf.all.disable_ipv6=0
sudo sysctl net.ipv6.conf.default.disable_ipv6=0
make verify
Expand Down
54 changes: 32 additions & 22 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,45 @@
# golangci-lint v2 config — preserves the linters from the original v1 file:
# golint -> revive, gosimple -> staticcheck, deadcode/structcheck -> unused,
# gofmt/goimports -> formatters, typecheck is always enabled in v2.
version: "2"

linters-settings:
golint:
revive:
min-confidence: 0

misspell:
locale: US

run:
timeout: 10m
build-tags:
- kqueue

linters:
disable-all: true
default: none
enable:
- typecheck
- goimports
- misspell
- govet
- golint
- misspell
- ineffassign
- gosimple
- deadcode
- structcheck
- staticcheck
- unused
- gomodguard
- revive
exclusions:
paths:
- pkg/rpc
- pkg/argon2
generated: lax

formatters:
enable:
- gofmt
- goimports
exclusions:
paths:
- pkg/rpc
- pkg/argon2

issues:
exclude-use-default: false
exclude:
- should have a package comment
- error strings should not be capitalized or end with punctuation or a newline

run:
skip-dirs:
- pkg/rpc
- pkg/argon2

service:
golangci-lint-version: 1.20.0 # use the fixed version to not introduce new linters unexpectedly
exclude-rules:
- text: should have a package comment
- text: error strings should not be capitalized or end with punctuation or a newline
13 changes: 10 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ LDFLAGS := $(shell go run buildscripts/gen-ldflags.go)
GOARCH := $(shell go env GOARCH)
GOOS := $(shell go env GOOS)

# v2.4.0+ is required for Go 1.25 export data format support.
GOLANGCI_VERSION ?= v2.4.0
GOLANGCI_LINT := $(GOPATH)/bin/golangci-lint

VERSION ?= $(shell git describe --tags)
TAG ?= "minio/minio:$(VERSION)"

Expand All @@ -16,7 +20,10 @@ checks:

getdeps:
@mkdir -p ${GOPATH}/bin
@which golangci-lint 1>/dev/null || (echo "Installing golangci-lint" && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin v1.27.0)
@if [ ! -x "$(GOLANGCI_LINT)" ] || ! $(GOLANGCI_LINT) version 2>/dev/null | grep -qE 'version 2\.'; then \
echo "Installing golangci-lint $(GOLANGCI_VERSION)"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_VERSION); \
fi
@which msgp 1>/dev/null || (echo "Installing msgp" && go get github.com/tinylib/msgp@v1.1.3)
@which stringer 1>/dev/null || (echo "Installing stringer" && go get golang.org/x/tools/cmd/stringer)

Expand All @@ -31,8 +38,8 @@ check-gen:

lint:
@echo "Running $@ check"
@GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --build-tags kqueue --timeout=10m --config ./.golangci.yml
@GO111MODULE=on $(GOLANGCI_LINT) cache clean
@GO111MODULE=on $(GOLANGCI_LINT) run --config ./.golangci.yml

# Builds minio, runs the verifiers then runs the tests.
check: test
Expand Down
Loading
Loading