Skip to content

Commit

Permalink
refactor: run stricter formatter
Browse files Browse the repository at this point in the history
gofumpt is a bit more strict than fmt
I run this every year or so to standardize various formatting things.
  • Loading branch information
crhntr committed Feb 22, 2024
1 parent aa6aaf4 commit 817a610
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
5 changes: 3 additions & 2 deletions internal/acceptance/workflows/scenario/step_funcs_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"bytes"
"context"
"fmt"
"github.com/cucumber/godog"
"os"
"path/filepath"
"strconv"
"strings"

"github.com/cucumber/godog"
)

func outputContainsSubstring(ctx context.Context, outputName, substring string) error {
Expand Down Expand Up @@ -76,5 +77,5 @@ func iWriteFileWith(ctx context.Context, fileName string, lines *godog.Table) er
}

fileName = filepath.Join(tileDir, fileName)
return os.WriteFile(fileName, out.Bytes(), 0644)
return os.WriteFile(fileName, out.Bytes(), 0o644)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/cucumber/godog"
"io"
"io/fs"
"os"
Expand All @@ -13,6 +12,8 @@ import (
"slices"
"strings"

"github.com/cucumber/godog"

"github.com/pivotal-cf/kiln/pkg/cargo"
)

Expand Down
1 change: 0 additions & 1 deletion pkg/notes/notes_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ func (t *TrainstatClient) FetchTrainstatNotes(ctx context.Context, milestone str
func (t *TrainstatClient) FetchTrainstatWinfsVersionInfo(ctx context.Context, milestone string, version string) (bumped bool, winfsVersion string, err error) {
baseURL := fmt.Sprintf("%s/%s", t.host, "api/v1/get_winfs_version_bump")
req, err := http.NewRequestWithContext(ctx, http.MethodGet, baseURL, nil)

if err != nil {
return false, "", err
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/source/bake_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package source
import (
"encoding/json"
"fmt"
"gopkg.in/yaml.v3"
"io/fs"
"os"
"path"
"path/filepath"
"slices"
"strings"

"gopkg.in/yaml.v3"

"github.com/pivotal-cf/kiln/internal/builder"

"github.com/Masterminds/semver/v3"
Expand Down Expand Up @@ -90,7 +91,7 @@ func (b BakeRecord) WriteFile(tileSourceDirectory string) error {
if b.IsDevBuild() {
return fmt.Errorf("will not write development builds to %s directory", BakeRecordsDirectory)
}
if err := os.MkdirAll(filepath.Join(tileSourceDirectory, BakeRecordsDirectory), 0766); err != nil {
if err := os.MkdirAll(filepath.Join(tileSourceDirectory, BakeRecordsDirectory), 0o766); err != nil {
return err
}
buf, err := json.MarshalIndent(b, "", " ")
Expand All @@ -105,7 +106,7 @@ func (b BakeRecord) WriteFile(tileSourceDirectory string) error {
if _, err := os.Stat(outputFilepath); err == nil {
return fmt.Errorf("tile bake record already exists for %s", b.Name())
}
return os.WriteFile(outputFilepath, buf, 0644)
return os.WriteFile(outputFilepath, buf, 0o644)
}

func ReadBakeRecords(dir fs.FS) ([]BakeRecord, error) {
Expand Down
4 changes: 2 additions & 2 deletions pkg/source/bake_record_test.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package source_test

import (
"github.com/pivotal-cf/kiln/internal/builder"
"os"
"path/filepath"
"testing"

"github.com/pivotal-cf/kiln/internal/builder"

"github.com/stretchr/testify/require"

"github.com/pivotal-cf/kiln/pkg/source"
)

func TestBuild(t *testing.T) {

t.Run("when creating a bake record from a product template", func(t *testing.T) {
// language=yaml
b, err := source.NewBakeRecord([]byte(`
Expand Down

0 comments on commit 817a610

Please sign in to comment.