update lint to go1.16/golangci

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2021-02-16 23:42:08 -08:00
parent 905be6431b
commit dba79ba223
10 changed files with 52 additions and 37 deletions

View File

@@ -56,7 +56,7 @@ func ParseCompose(dt []byte) (*Config, error) {
if reflect.DeepEqual(s.Build, zeroBuildConfig) {
// if not make sure they're setting an image or it's invalid d-c.yml
if s.Image == "" {
return nil, fmt.Errorf("compose file invalid: service %s has neither an image nor a build context specified. At least one must be provided.", s.Name)
return nil, fmt.Errorf("compose file invalid: service %s has neither an image nor a build context specified. At least one must be provided", s.Name)
}
continue
}

View File

@@ -161,9 +161,8 @@ func parseHCL(dt []byte, fn string) (_ *Config, err error) {
fnl := strings.ToLower(fn)
if strings.HasSuffix(fnl, ".json") {
return nil, jsondiags
} else {
return nil, hcldiags
}
return nil, hcldiags
}
}

View File

@@ -21,7 +21,7 @@ type Input struct {
}
func ReadRemoteFiles(ctx context.Context, dis []build.DriverInfo, url string, names []string, pw progress.Writer) ([]File, *Input, error) {
st, filename, ok := detectHttpContext(url)
st, filename, ok := detectHTTPContext(url)
if !ok {
st, ok = detectGitContext(url)
if !ok {
@@ -83,7 +83,7 @@ func ReadRemoteFiles(ctx context.Context, dis []build.DriverInfo, url string, na
}
func IsRemoteURL(url string) bool {
if _, _, ok := detectHttpContext(url); ok {
if _, _, ok := detectHTTPContext(url); ok {
return true
}
if _, ok := detectGitContext(url); ok {
@@ -92,7 +92,7 @@ func IsRemoteURL(url string) bool {
return false
}
func detectHttpContext(url string) (*llb.State, string, bool) {
func detectHTTPContext(url string) (*llb.State, string, bool) {
if httpPrefix.MatchString(url) {
httpContext := llb.HTTP(url, llb.Filename("context"), llb.WithCustomName("[internal] load remote build context"))
return &httpContext, "context", true