Skip to content

Commit

Permalink
lint: enable linter & fix formatting issues
Browse files Browse the repository at this point in the history
This also rewords some comments to avoid triggering weird
smart quote behavior in `gofmt`.

Signed-off-by: Milas Bowman <[email protected]>
  • Loading branch information
milas committed Feb 28, 2023
1 parent fc7f2b8 commit 497296f
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# required for golangci-lint on Windows
*.go text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
cache: true
- uses: golangci/golangci-lint-action@v3
with:
version: v1.51.1
version: v1.51.2
args: --timeout 5m
- name: Test
run: go test ./...
File renamed without changes.
2 changes: 1 addition & 1 deletion ci/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FROM golang:1.20

WORKDIR /go/src

ARG GOLANGCILINT_VERSION=v1.51.1
ARG GOLANGCILINT_VERSION=v1.51.2
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCILINT_VERSION}
RUN go install github.com/kunalkushwaha/ltag@latest && rm -rf /go/src/github.com/kunalkushwaha

Expand Down
2 changes: 1 addition & 1 deletion loader/loader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func TestLoadFromFile(t *testing.T) {
}
tmpdir := t.TempDir()
tmpPath := filepath.Join(tmpdir, "Docker-compose.yaml")
if err := os.WriteFile(tmpPath, []byte(sampleYAML), 0444); err != nil {
if err := os.WriteFile(tmpPath, []byte(sampleYAML), 0o444); err != nil {
t.Fatalf("failed to write temporary file: %s", err)
}
actual, err := Load(types.ConfigDetails{
Expand Down
2 changes: 1 addition & 1 deletion loader/windows_path.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func isAbs(path string) (b bool) {

// volumeNameLen returns length of the leading volume name on Windows.
// It returns 0 elsewhere.
//nolint: gocyclo
// nolint: gocyclo
func volumeNameLen(path string) int {
if len(path) < 2 {
return 0
Expand Down
1 change: 1 addition & 0 deletions schema/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func init() {
}

// Schema is the compose-spec JSON schema
//
//go:embed compose-spec.json
var Schema string

Expand Down
12 changes: 6 additions & 6 deletions types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ type ServiceConfig struct {
// Command for the service containers.
// If set, overrides COMMAND from the image.
//
// Set to `[]` or `''` to clear the command from the image.
// Set to `[]` or an empty string to clear the command from the image.
Command ShellCommand `yaml:",omitempty" json:"command"` // NOTE: we can NOT omitempty for JSON! see ShellCommand type for details.

Configs []ServiceConfigObjConfig `yaml:",omitempty" json:"configs,omitempty"`
Expand All @@ -126,7 +126,7 @@ type ServiceConfig struct {
// Entrypoint for the service containers.
// If set, overrides ENTRYPOINT from the image.
//
// Set to `[]` or `''` to clear the entrypoint from the image.
// Set to `[]` or an empty string to clear the entrypoint from the image.
Entrypoint ShellCommand `yaml:"entrypoint,omitempty" json:"entrypoint"` // NOTE: we can NOT omitempty for JSON! see ShellCommand type for details.

Environment MappingWithEquals `yaml:",omitempty" json:"environment,omitempty"`
Expand Down Expand Up @@ -333,13 +333,13 @@ type ThrottleDevice struct {
// ShellCommand is a string or list of string args.
//
// When marshaled to YAML, nil command fields will be omitted if `omitempty`
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or `''`)
// will serialize to an empty array (`[]`).
// is specified as a struct tag. Explicitly empty commands (i.e. `[]` or
// empty string will serialize to an empty array (`[]`).
//
// When marshaled to JSON, the `omitempty` struct must NOT be specified.
// If the command field is nil, it will be serialized as `null`.
// Explicitly empty commands (i.e. `[]` or `''`) will serialize to an empty
// array (`[]`).
// Explicitly empty commands (i.e. `[]` or empty string) will serialize to
// an empty array (`[]`).
//
// The distinction between nil and explicitly empty is important to distinguish
// between an unset value and a provided, but empty, value, which should be
Expand Down

0 comments on commit 497296f

Please sign in to comment.