chore: upgrade golangci-lint to v1.16.0 (#515)

Signed-off-by: Andrew Rynhard <andrew@andrewrynhard.com>
This commit is contained in:
Andrew Rynhard 2019-04-09 21:53:35 -07:00 committed by GitHub
parent 3151f9d7a3
commit 7688de6a3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 24 additions and 36 deletions

View File

@ -235,7 +235,7 @@ COPY --from=test-runner /src/coverage.txt /coverage.txt
# The lint target performs linting on the codebase.
FROM base AS lint
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.14.0
RUN curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | bash -s -- -b /toolchain/bin v1.16.0
COPY hack/golang/golangci-lint.yaml .
RUN golangci-lint run --config golangci-lint.yaml
#

View File

@ -77,9 +77,6 @@ func NewClient(port int, clientcreds *Credentials) (c *Client, err error) {
return nil, fmt.Errorf("could not load client key pair: %s", err)
}
certPool := x509.NewCertPool()
if err != nil {
return nil, fmt.Errorf("could not read ca certificate: %s", err)
}
if ok := certPool.AppendCertsFromPEM(clientcreds.ca); !ok {
return nil, fmt.Errorf("failed to append client certs")
}

View File

@ -99,7 +99,6 @@ linters:
disable:
- gas
- typecheck
- megacheck
- gochecknoglobals
- gochecknoinits
disable-all: false

View File

@ -123,7 +123,7 @@ func (k *Kubeadm) Start(data *userdata.UserData) error {
certificateKey := "--certificate-key=" + encoded
switch {
case data.IsBootstrap() == true:
case data.IsBootstrap():
args.ProcessArgs = []string{
"kubeadm",
"init",
@ -134,7 +134,7 @@ func (k *Kubeadm) Start(data *userdata.UserData) error {
"--skip-certificate-key-print",
"--experimental-upload-certs",
}
case data.IsControlPlane() == true:
case data.IsControlPlane():
args.ProcessArgs = []string{
"kubeadm",
"join",

View File

@ -86,23 +86,21 @@ func (n *NTP) Daemon() {
log.Println(time.Now())
for {
select {
case <-ticker.C:
// Set some variance with how frequently we poll ntp servers
if err = n.Query(); err != nil {
log.Printf("error querying %s for time, %s", n.Server, err)
continue
}
log.Printf("%+v\n", n.Response)
log.Println("Current time")
log.Println(time.Now())
if err = n.SetTime(); err != nil {
log.Printf("failed to set time, %s", err)
continue
}
log.Println("Updated time")
log.Println(time.Now())
<-ticker.C
// Set some variance with how frequently we poll ntp servers
if err = n.Query(); err != nil {
log.Printf("error querying %s for time, %s", n.Server, err)
continue
}
log.Printf("%+v\n", n.Response)
log.Println("Current time")
log.Println(time.Now())
if err = n.SetTime(); err != nil {
log.Printf("failed to set time, %s", err)
continue
}
log.Println("Updated time")
log.Println(time.Now())
ticker = time.NewTicker(time.Duration(rando.Intn(MAXPOLL)+MINPOLL) * time.Second)
}
}

View File

@ -140,7 +140,7 @@ type GenericIOHeader struct {
Timeout uint32
Flags uint32
PackID int32
pad0 [4]byte // nolint: structcheck
pad0 [4]byte // nolint: structcheck, unused
UsrPtr *byte
Status uint8
MaskedStatus uint8
@ -355,9 +355,10 @@ func (dvc *Device) Page83Inquiry() (err error) {
descriptor := buf[i:]
// Determinine the association.
// TODO(andrewrynhard): This should be a function.
if descriptor[1]&0x30 == 0x10 {
} else if descriptor[1]&0x30 == 0 {
}
// TODO(andrewrynhard): Complete this if statement.
//if descriptor[1]&0x30 == 0x10 {
//} else if descriptor[1]&0x30 == 0 {
//}
if descriptor[0]&0x0f == CodeSetASCII {
continue

View File

@ -39,7 +39,7 @@ func WithPartitionName(o string) Option {
// WithLegacyBIOSBootableAttribute marks the partition as bootable.
func WithLegacyBIOSBootableAttribute(o bool) Option {
return func(args *Options) {
if o == true {
if o {
args.Flags = 4
}
}

View File

@ -27,9 +27,6 @@ const (
// NewConfig initializes a TLS config for the specified type.
func NewConfig(t Type, data *userdata.OSSecurity) (config *tls.Config, err error) {
certPool := x509.NewCertPool()
if err != nil {
return nil, fmt.Errorf("could not read ca certificate: %s", err)
}
if ok := certPool.AppendCertsFromPEM(data.CA.Crt); !ok {
return nil, fmt.Errorf("failed to append client certs")
}

View File

@ -45,7 +45,7 @@ func NewMountPoint(source string, target string, fstype string, flags uintptr, d
// NewMountPoints initializes and returns a Points struct.
func NewMountPoints() *Points {
return &Points{
points: make(PointMap, 0),
points: make(PointMap),
}
}

View File

@ -394,10 +394,6 @@ func Download(url string, headers *map[string]string) (data *UserData, err error
}
dataBytes, err := ioutil.ReadAll(resp.Body)
if err != nil {
return data, err
}
if err != nil {
return data, fmt.Errorf("read user data: %s", err.Error())
}