Skip to content

chore: format go code using gofumpt #172

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ name: ci

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

permissions:
Expand Down Expand Up @@ -53,22 +57,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Echo Go Cache Paths
id: go-cache-paths
run: |
echo "GOCACHE=$(go env GOCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT
echo "GOMODCACHE=$(go env GOMODCACHE)" >> ${{ runner.os == 'Windows' && '$env:' || '$' }}GITHUB_OUTPUT

- name: Go Build Cache
uses: actions/cache@v3
with:
path: ${{ steps.go-cache-paths.outputs.GOCACHE }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.**', '**.go') }}

- uses: actions/setup-go@v3
- uses: actions/setup-go@v5
with:
go-version: "~1.21"

Expand All @@ -77,3 +67,15 @@ jobs:

- name: Check for unstaged files
run: git diff --exit-code
fmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version: "~1.21"

- name: Check format
run: bash ./scripts/check_fmt.sh
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
GOARCH := $(shell go env GOARCH)
PWD=$(shell pwd)

fmt: **/*.go
go run mvdan.cc/[email protected] -l -w .

develop:
./scripts/develop.sh

Expand Down
6 changes: 3 additions & 3 deletions devcontainer/devcontainer.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (s *Spec) Compile(fs billy.Filesystem, devcontainerDir, scratchDir string,
if s.Image != "" {
// We just write the image to a file and return it.
dockerfilePath := filepath.Join(scratchDir, "Dockerfile")
file, err := fs.OpenFile(dockerfilePath, os.O_CREATE|os.O_WRONLY, 0644)
file, err := fs.OpenFile(dockerfilePath, os.O_CREATE|os.O_WRONLY, 0o644)
if err != nil {
return nil, fmt.Errorf("open dockerfile: %w", err)
}
Expand Down Expand Up @@ -228,7 +228,7 @@ func (s *Spec) compileFeatures(fs billy.Filesystem, devcontainerDir, scratchDir
}

featuresDir := filepath.Join(scratchDir, "features")
err := fs.MkdirAll(featuresDir, 0644)
err := fs.MkdirAll(featuresDir, 0o644)
if err != nil {
return "", nil, fmt.Errorf("create features directory: %w", err)
}
Expand Down Expand Up @@ -278,7 +278,7 @@ func (s *Spec) compileFeatures(fs billy.Filesystem, devcontainerDir, scratchDir
featureSha := md5.Sum([]byte(featureRefRaw))
featureName := filepath.Base(featureRef)
featureDir := filepath.Join(featuresDir, fmt.Sprintf("%s-%x", featureName, featureSha[:4]))
if err := fs.MkdirAll(featureDir, 0644); err != nil {
if err := fs.MkdirAll(featureDir, 0o644); err != nil {
return "", nil, err
}
spec, err := features.Extract(fs, devcontainerDir, featureDir, featureRefRaw)
Expand Down
4 changes: 2 additions & 2 deletions devcontainer/devcontainer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func TestCompileDevContainer(t *testing.T) {
},
}
dcDir := "/workspaces/coder/.devcontainer"
err := fs.MkdirAll(dcDir, 0755)
err := fs.MkdirAll(dcDir, 0o755)
require.NoError(t, err)
file, err := fs.OpenFile(filepath.Join(dcDir, "Dockerfile"), os.O_CREATE|os.O_WRONLY, 0644)
file, err := fs.OpenFile(filepath.Join(dcDir, "Dockerfile"), os.O_CREATE|os.O_WRONLY, 0o644)
require.NoError(t, err)
_, err = io.WriteString(file, "FROM localhost:5000/envbuilder-test-ubuntu:latest")
require.NoError(t, err)
Expand Down
4 changes: 2 additions & 2 deletions devcontainer/features/features.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func extractFromImage(fs billy.Filesystem, directory, reference string) error {
path := filepath.Join(directory, header.Name)
switch header.Typeflag {
case tar.TypeDir:
err = fs.MkdirAll(path, 0755)
err = fs.MkdirAll(path, 0o755)
if err != nil {
return fmt.Errorf("mkdir %s: %w", path, err)
}
Expand Down Expand Up @@ -126,7 +126,7 @@ func Extract(fs billy.Filesystem, devcontainerDir, directory, reference string)
if ok {
// For some reason the filesystem abstraction doesn't support chmod.
// https://github.com/src-d/go-billy/issues/56
err = chmodder.Chmod(installScriptPath, 0755)
err = chmodder.Chmod(installScriptPath, 0o755)
}
if err != nil {
return nil, fmt.Errorf("chmod install.sh: %w", err)
Expand Down
8 changes: 4 additions & 4 deletions envbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func Run(ctx context.Context, options Options) error {
if err != nil {
return fmt.Errorf("parse docker config: %w", err)
}
err = os.WriteFile(filepath.Join(MagicDir, "config.json"), decoded, 0644)
err = os.WriteFile(filepath.Join(MagicDir, "config.json"), decoded, 0o644)
if err != nil {
return fmt.Errorf("write docker config: %w", err)
}
Expand Down Expand Up @@ -225,7 +225,7 @@ func Run(ctx context.Context, options Options) error {

defaultBuildParams := func() (*devcontainer.Compiled, error) {
dockerfile := filepath.Join(MagicDir, "Dockerfile")
file, err := options.Filesystem.OpenFile(dockerfile, os.O_CREATE|os.O_WRONLY, 0644)
file, err := options.Filesystem.OpenFile(dockerfile, os.O_CREATE|os.O_WRONLY, 0o644)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -705,7 +705,7 @@ func Run(ctx context.Context, options Options) error {
endStage("👤 Updated the ownership of the workspace!")
}

err = os.MkdirAll(options.WorkspaceFolder, 0755)
err = os.MkdirAll(options.WorkspaceFolder, 0o755)
if err != nil {
return fmt.Errorf("create workspace folder: %w", err)
}
Expand Down Expand Up @@ -962,7 +962,7 @@ func createPostStartScript(path string, postStartCommand devcontainer.LifecycleS
}
defer postStartScript.Close()

if err := postStartScript.Chmod(0755); err != nil {
if err := postStartScript.Chmod(0o755); err != nil {
return err
}

Expand Down
12 changes: 6 additions & 6 deletions envbuilder_internal_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace/.devcontainer", 0600)
err := fs.MkdirAll("/workspace/.devcontainer", 0o600)
require.NoError(t, err)

// when
Expand All @@ -50,7 +50,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace/.devcontainer", 0600)
err := fs.MkdirAll("/workspace/.devcontainer", 0o600)
require.NoError(t, err)
fs.Create("/workspace/.devcontainer/devcontainer.json")

Expand All @@ -71,7 +71,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace/experimental-devcontainer", 0600)
err := fs.MkdirAll("/workspace/experimental-devcontainer", 0o600)
require.NoError(t, err)
fs.Create("/workspace/experimental-devcontainer/devcontainer.json")

Expand All @@ -93,7 +93,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace/.devcontainer", 0600)
err := fs.MkdirAll("/workspace/.devcontainer", 0o600)
require.NoError(t, err)
fs.Create("/workspace/.devcontainer/experimental.json")

Expand All @@ -115,7 +115,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace", 0600)
err := fs.MkdirAll("/workspace", 0o600)
require.NoError(t, err)
fs.Create("/workspace/devcontainer.json")

Expand All @@ -136,7 +136,7 @@ func TestFindDevcontainerJSON(t *testing.T) {

// given
fs := memfs.New()
err := fs.MkdirAll("/workspace/.devcontainer/sample", 0600)
err := fs.MkdirAll("/workspace/.devcontainer/sample", 0o600)
require.NoError(t, err)
fs.Create("/workspace/.devcontainer/sample/devcontainer.json")

Expand Down
2 changes: 1 addition & 1 deletion git.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func CloneRepo(ctx context.Context, opts CloneRepoOptions) (bool, error) {
}
}

err = opts.Storage.MkdirAll(opts.Path, 0755)
err = opts.Storage.MkdirAll(opts.Path, 0o755)
if err != nil {
return false, fmt.Errorf("mkdir %q: %w", opts.Path, err)
}
Expand Down
2 changes: 1 addition & 1 deletion git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func TestCloneRepo(t *testing.T) {

func mustRead(t *testing.T, fs billy.Filesystem, path string) string {
t.Helper()
f, err := fs.OpenFile(path, os.O_RDONLY, 0644)
f, err := fs.OpenFile(path, os.O_RDONLY, 0o644)
require.NoError(t, err)
content, err := io.ReadAll(f)
require.NoError(t, err)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ require (
github.com/ebitengine/purego v0.5.0-alpha.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
github.com/frankban/quicktest v1.14.6 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/go-chi/chi/v5 v5.0.10 // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
Expand Down Expand Up @@ -220,6 +221,7 @@ require (
github.com/richardartoul/molecule v1.0.1-0.20221107223329-32cfee06a052 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/rootless-containers/rootlesskit v1.1.0 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect
Expand Down
11 changes: 7 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV
github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs=
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.18 h1:n56/Zwd5o6whRC5PMGretI4IdRLlmBXYNjScPaBgsbY=
github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr4O4=
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
Expand Down Expand Up @@ -290,8 +291,8 @@ github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4Nij
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.5 h1:dfYrrRyLtiqT9GyKXgdh+k4inNeTvmGbuSgZ3lx3GhA=
github.com/frankban/quicktest v1.14.5/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8=
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa h1:RDBNVkRviHZtvDvId8XSGPu3rmpmSe+wKRcEWNgsfWU=
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88=
Expand Down Expand Up @@ -697,6 +698,7 @@ github.com/pion/udp v0.1.4 h1:OowsTmu1Od3sD6i3fQUJxJn2fEvJO6L1TidgadtbTI8=
github.com/pion/udp v0.1.4/go.mod h1:G8LDo56HsFwC24LIcnT4YIDU5qcB6NepqqjP0keL2us=
github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4=
github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down Expand Up @@ -733,8 +735,9 @@ github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs=
github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro=
github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M=
github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rootless-containers/rootlesskit v1.1.0 h1:cRaRIYxY8oce4eE/zeAUZhgKu/4tU1p9YHN4+suwV7M=
github.com/rootless-containers/rootlesskit v1.1.0/go.mod h1:H+o9ndNe7tS91WqU0/+vpvc+VaCd7TCIWaJjnV0ujUo=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
4 changes: 2 additions & 2 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func TestBuildIgnoreVarRunSecrets(t *testing.T) {
},
})
dir := t.TempDir()
err := os.WriteFile(filepath.Join(dir, "secret"), []byte("test"), 0644)
err := os.WriteFile(filepath.Join(dir, "secret"), []byte("test"), 0o644)
require.NoError(t, err)
ctr, err := runEnvbuilder(t, options{
env: []string{
Expand Down Expand Up @@ -360,6 +360,7 @@ func TestBuildFromDevcontainerInSubfolder(t *testing.T) {
output := execContainer(t, ctr, "echo hello")
require.Equal(t, "hello", strings.TrimSpace(output))
}

func TestBuildFromDevcontainerInRoot(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -772,7 +773,6 @@ func setupPassthroughRegistry(t *testing.T, image string, auth *registryAuth) st
}

proxy.ServeHTTP(w, r)

}))
return fmt.Sprintf("%s/%s", strings.TrimPrefix(srv.URL, "http://"), image)
}
Expand Down
3 changes: 1 addition & 2 deletions options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func TestCLIOutput(t *testing.T) {
require.NoError(t, err)

if *updateCLIOutputGoldenFiles {
err = os.WriteFile("testdata/options.golden", b.Stdout.Bytes(), 0644)
err = os.WriteFile("testdata/options.golden", b.Stdout.Bytes(), 0o644)
require.NoError(t, err)
t.Logf("updated golden file: testdata/options.golden")
} else {
Expand All @@ -111,7 +111,6 @@ func runCLI() envbuilder.Options {
i := cmd.Invoke().WithOS()
fakeIO(i)
err := i.Run()

if err != nil {
panic("failed to run CLI: " + err.Error())
}
Expand Down
8 changes: 8 additions & 0 deletions scripts/check_fmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

list="$(go run mvdan.cc/[email protected] -l .)"
if [[ -n $list ]]; then
echo -e "error: The following files have changes:\n\n${list}\n\nDiff:\n\n"
go run mvdan.cc/[email protected] -d .
exit 1
fi
2 changes: 1 addition & 1 deletion scripts/docsgen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func main() {
mkd := "\n## Environment Variables\n\n" + options.Markdown()
modifiedContent := readmeContent[:startIndex+len(startSection)] + mkd + readmeContent[endIndex:]

err = os.WriteFile(readmePath, []byte(modifiedContent), 0644)
err = os.WriteFile(readmePath, []byte(modifiedContent), 0o644)
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion testutil/gittest/gittest.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func NewRepo(t *testing.T, fs billy.Filesystem, commits ...CommitFunc) *git.Repo
// WriteFile writes a file to the filesystem.
func WriteFile(t *testing.T, fs billy.Filesystem, path, content string) {
t.Helper()
file, err := fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0644)
file, err := fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o644)
require.NoError(t, err)
_, err = file.Write([]byte(content))
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion testutil/registrytest/registrytest.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func WriteContainer(t *testing.T, serverURL, containerRef, mediaType string, fil
require.NoError(t, err)
}
err := wtr.WriteHeader(&tar.Header{
Mode: 0777,
Mode: 0o777,
Name: name,
Typeflag: tar.TypeReg,
Size: int64(len(data)),
Expand Down
Loading