fix-up staticcheck problems

This commit is contained in:
tanjunchen 2019-10-29 13:54:27 +08:00
parent 69fe8e3689
commit d6db19ed20
6 changed files with 7 additions and 7 deletions

View File

@ -155,7 +155,7 @@ func actionServerCommand(ctx *cli.Context) error {
// waitForCertificates is responsible for waiting for the certificates to appear
func waitForCertificates(files []string, timeout time.Duration) error {
doneCh := make(chan struct{}, 0)
doneCh := make(chan struct{})
go func() {
expires := time.Now().Add(timeout)

View File

@ -49,8 +49,8 @@ func NewVerifier() (server.Verifier, error) {
// Verify is responsible for build a identification document
func (a *awsNodeVerifier) VerifyIdentity(ctx context.Context) ([]byte, error) {
errs := make(chan error, 0)
doneCh := make(chan []byte, 0)
errs := make(chan error)
doneCh := make(chan []byte)
go func() {
encoded, err := func() ([]byte, error) {

View File

@ -35,7 +35,7 @@ var (
// authorizeNodeRequest is responsible for handling the incoming authorization request
func (n *NodeAuthorizer) authorizeNodeRequest(ctx context.Context, request *NodeRegistration) error {
doneCh := make(chan error, 0)
doneCh := make(chan error)
// @step: create a context to run under
ctx, cancel := context.WithTimeout(ctx, n.config.AuthorizationTimeout)

View File

@ -79,7 +79,7 @@ func (e *VPC) Find(c *fi.Context) (*VPC, error) {
}
}
if vpcs == nil || len(vpcs) == 0 {
if len(vpcs) == 0 {
return nil, nil
}

View File

@ -328,7 +328,7 @@ func ZoneToVSwitchID(VPCID string, zones []string, vswitchIDs []string) (map[str
return res, fmt.Errorf("error describing VPC: %v", err)
}
if vpc == nil || len(vpc) == 0 {
if len(vpc) == 0 {
return res, fmt.Errorf("VPC %q not found", VPCID)
}

View File

@ -42,7 +42,7 @@ func buildEphemeralDevices(cloud awsup.AWSCloud, machineType string) (map[string
// buildAdditionalDevices is responsible for creating additional volumes in this lc
func buildAdditionalDevices(volumes []*BlockDeviceMapping) (map[string]*BlockDeviceMapping, error) {
devices := make(map[string]*BlockDeviceMapping, 0)
devices := make(map[string]*BlockDeviceMapping)
// @step: iterate the volumes and create devices from them
for _, x := range volumes {