Skip to content

Commit 764e9b8

Browse files
upgrade golang-lint and fix the reported issues (#1329)
1 parent 051da3c commit 764e9b8

File tree

6 files changed

+107
-32
lines changed

6 files changed

+107
-32
lines changed

Makefile

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1+
GOPATH := $(shell go env GOPATH)
2+
13
all: checks
24

35
.PHONY: examples docs
46

5-
checks: diff vet test examples functional-test
7+
checks: lint vet test examples functional-test
68

7-
diff:
8-
@curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.21.0
9-
@./golangci-lint run --timeout=5m --config ./.golangci.yml
9+
lint:
10+
@mkdir -p ${GOPATH}/bin
11+
@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)
12+
@echo "Running $@ check"
13+
@GO111MODULE=on ${GOPATH}/bin/golangci-lint cache clean
14+
@GO111MODULE=on ${GOPATH}/bin/golangci-lint run --timeout=5m --config ./.golangci.yml
1015

1116
vet:
1217
@GO111MODULE=on go vet ./...

NOTICE

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
1-
minio-go
2-
Copyright 2015-2017 MinIO, Inc.
1+
MinIO Cloud Storage, (C) 2014-2020 MinIO, Inc.
2+
3+
This product includes software developed at MinIO, Inc.
4+
(https://min.io/).
5+
6+
The MinIO project contains unmodified/modified subcomponents too with
7+
separate copyright notices and license terms. Your use of the source
8+
code for these subcomponents is subject to the terms and conditions
9+
of Apache License Version 2.0

code_of_conduct.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
## Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
## Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior, in compliance with the
39+
licensing terms applying to the Project developments.
40+
41+
Project maintainers have the right and responsibility to remove, edit, or
42+
reject comments, commits, code, wiki edits, issues, and other contributions
43+
that are not aligned to this Code of Conduct, or to ban temporarily or
44+
permanently any contributor for other behaviors that they deem inappropriate,
45+
threatening, offensive, or harmful. However, these actions shall respect the
46+
licensing terms of the Project Developments that will always supersede such
47+
Code of Conduct.
48+
49+
## Scope
50+
51+
This Code of Conduct applies both within project spaces and in public spaces
52+
when an individual is representing the project or its community. Examples of
53+
representing a project or community include using an official project e-mail
54+
address, posting via an official social media account, or acting as an appointed
55+
representative at an online or offline event. Representation of a project may be
56+
further defined and clarified by project maintainers.
57+
58+
## Enforcement
59+
60+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
61+
reported by contacting the project team at [email protected]. The project team
62+
will review and investigate all complaints, and will respond in a way that it deems
63+
appropriate to the circumstances. The project team is obligated to maintain
64+
confidentiality with regard to the reporter of an incident.
65+
Further details of specific enforcement policies may be posted separately.
66+
67+
Project maintainers who do not follow or enforce the Code of Conduct in good
68+
faith may face temporary or permanent repercussions as determined by other
69+
members of the project's leadership.
70+
71+
## Attribution
72+
73+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
74+
available at [http://contributor-covenant.org/version/1/4][version]
75+
76+
This version includes a clarification to ensure that the code of conduct is in
77+
compliance with the free software licensing terms of the project.
78+
79+
[homepage]: http://contributor-covenant.org
80+
[version]: http://contributor-covenant.org/version/1/4/

go.mod

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ module github.com/minio/minio-go/v7
33
go 1.12
44

55
require (
6-
github.com/json-iterator/go v1.1.9
6+
github.com/json-iterator/go v1.1.10
77
github.com/minio/md5-simd v1.1.0
8-
github.com/minio/minio-go/v6 v6.0.57 // indirect
98
github.com/minio/sha256-simd v0.1.1
109
github.com/mitchellh/go-homedir v1.1.0
11-
github.com/sirupsen/logrus v1.6.0 // indirect
10+
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
1211
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f
1312
golang.org/x/net v0.0.0-20190522155817-f3200d17e092
1413
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
15-
gopkg.in/ini.v1 v1.42.0
14+
gopkg.in/ini.v1 v1.57.0
1615
)

go.sum

+4-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
22
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
4-
github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo=
5-
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
64
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
75
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
86
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
9-
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
10-
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
7+
github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68=
8+
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
119
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
1210
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
1311
github.com/klauspost/cpuid v1.2.3 h1:CCtW0xUnWGVINKvE/WWOYKdsPV6mawAtvQuSl8guwQs=
1412
github.com/klauspost/cpuid v1.2.3/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
15-
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
16-
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
1713
github.com/minio/md5-simd v1.1.0 h1:QPfiOqlZH+Cj9teu0t9b1nTBfPbyTl16Of5MeuShdK4=
1814
github.com/minio/md5-simd v1.1.0/go.mod h1:XpBqgZULrMYD3R+M28PcmP0CkI7PEMzB3U77ZrKZ0Gw=
19-
github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o=
20-
github.com/minio/minio-go/v6 v6.0.57 h1:ixPkbKkyD7IhnluRgQpGSpHdpvNVaW6OD5R9IAO/9Tw=
21-
github.com/minio/minio-go/v6 v6.0.57/go.mod h1:5+R/nM9Pwrh0vqF+HbYYDQ84wdUFPyXHkrdT4AIkifM=
2215
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
2316
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
2417
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
@@ -29,15 +22,11 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLD
2922
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
3023
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
3124
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
32-
github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo=
33-
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
34-
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
3525
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
3626
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
3727
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a h1:pa8hGb/2YqsZKovtsgrwcDH1RZhVbTKCjLp47XpqCDs=
3828
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
3929
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
40-
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
4130
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
4231
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
4332
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -50,11 +39,10 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR
5039
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
5140
golang.org/x/sys v0.0.0-20190412213103-97732733099d h1:+R4KGOnez64A81RvjARKc4UT5/tI9ujCIVX+P5KiHuI=
5241
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
53-
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5442
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
5543
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
5644
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
5745
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
5846
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
59-
gopkg.in/ini.v1 v1.42.0 h1:7N3gPTt50s8GuLortA00n8AqRTk75qOP98+mTPpgzRk=
60-
gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
47+
gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww=
48+
gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=

pkg/policy/bucket-policy-condition.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,7 @@ func (ckm ConditionKeyMap) Remove(key string, value set.StringSet) {
4646

4747
// RemoveKey - removes key and its value.
4848
func (ckm ConditionKeyMap) RemoveKey(key string) {
49-
if _, ok := ckm[key]; ok {
50-
delete(ckm, key)
51-
}
49+
delete(ckm, key)
5250
}
5351

5452
// CopyConditionKeyMap - returns new copy of given ConditionKeyMap.
@@ -91,9 +89,7 @@ func (cond ConditionMap) Add(condKey string, condKeyMap ConditionKeyMap) {
9189

9290
// Remove - removes condition key and its value.
9391
func (cond ConditionMap) Remove(condKey string) {
94-
if _, ok := cond[condKey]; ok {
95-
delete(cond, condKey)
96-
}
92+
delete(cond, condKey)
9793
}
9894

9995
// mergeConditionMap - returns new ConditionMap which contains merged key/value of two ConditionMap.

0 commit comments

Comments
 (0)