Skip to content

Commit 714862f

Browse files
authored
Merge pull request gopherjs#1207 from gopherjs/gofumpt
gofumpt the repo
2 parents aa25f6c + 0e53da9 commit 714862f

File tree

31 files changed

+132
-81
lines changed

31 files changed

+132
-81
lines changed

.github/workflows/lint.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: golangci-lint
2+
on:
3+
pull_request:
4+
permissions:
5+
contents: read
6+
jobs:
7+
golangci:
8+
name: lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- uses: actions/setup-go@v3
14+
with:
15+
go-version: "1.18.10"
16+
17+
- name: golangci-lint
18+
uses: golangci/golangci-lint-action@v3
19+
with:
20+
version: v1.53.3
21+
only-new-issues: true
22+
23+
- name: Check go.mod
24+
run: |
25+
go mod tidy && git diff --exit-code

.golangci.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[run]
2+
timeout = "1m"
3+
4+
[output]
5+
format = "colored-line-number"
6+
7+
[linters]
8+
disable-all = true
9+
enable = [
10+
"gofumpt",
11+
]
12+
13+
[issues]
14+
exclude-use-default = false

build/build.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ func (s *Session) SourceMappingCallback(m *sourcemap.Map) func(generatedLine, ge
730730

731731
// WriteCommandPackage writes the final JavaScript output file at pkgObj path.
732732
func (s *Session) WriteCommandPackage(archive *compiler.Archive, pkgObj string) error {
733-
if err := os.MkdirAll(filepath.Dir(pkgObj), 0777); err != nil {
733+
if err := os.MkdirAll(filepath.Dir(pkgObj), 0o777); err != nil {
734734
return err
735735
}
736736
codeFile, err := os.Create(pkgObj)

build/cache/cache.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func (bc *BuildCache) StoreArchive(a *compiler.Archive) {
9595
return // Caching is disabled.
9696
}
9797
path := cachedPath(bc.archiveKey(a.ImportPath))
98-
if err := os.MkdirAll(filepath.Dir(path), 0750); err != nil {
98+
if err := os.MkdirAll(filepath.Dir(path), 0o750); err != nil {
9999
log.Warningf("Failed to create build cache directory: %v", err)
100100
return
101101
}

build/embed.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,21 @@ func embedFiles(pkg *PackageData, fset *token.FileSet, files []*ast.File) (*ast.
5555
&ast.CallExpr{
5656
Fun: em.Spec.Type,
5757
Args: []ast.Expr{
58-
&ast.Ident{Name: buildIdent(fs[0].Name),
59-
NamePos: em.Spec.Names[0].NamePos},
58+
&ast.Ident{
59+
Name: buildIdent(fs[0].Name),
60+
NamePos: em.Spec.Names[0].NamePos,
61+
},
6062
},
61-
}}
63+
},
64+
}
6265
case goembed.EmbedBytes:
6366
// value = []byte(data)
6467
em.Spec.Values = []ast.Expr{
6568
&ast.CallExpr{
6669
Fun: em.Spec.Type,
6770
Args: []ast.Expr{ast.NewIdent(buildIdent(fs[0].Name))},
68-
}}
71+
},
72+
}
6973
case goembed.EmbedString:
7074
// value = data
7175
em.Spec.Values = []ast.Expr{ast.NewIdent(buildIdent(fs[0].Name))}
@@ -115,15 +119,15 @@ func embedFiles(pkg *PackageData, fset *token.FileSet, files []*ast.File) (*ast.
115119
Elt: &ast.StructType{
116120
Fields: &ast.FieldList{
117121
List: []*ast.Field{
118-
&ast.Field{
122+
{
119123
Names: []*ast.Ident{ast.NewIdent("name")},
120124
Type: ast.NewIdent("string"),
121125
},
122-
&ast.Field{
126+
{
123127
Names: []*ast.Ident{ast.NewIdent("data")},
124128
Type: ast.NewIdent("string"),
125129
},
126-
&ast.Field{
130+
{
127131
Names: []*ast.Ident{ast.NewIdent("hash")},
128132
Type: &ast.ArrayType{
129133
Len: &ast.BasicLit{Kind: token.INT, Value: "16"},

circle.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ jobs:
7272
executor: gopherjs
7373
steps:
7474
- setup_and_install_gopherjs
75-
- run:
76-
name: Check gofmt
77-
command: diff -u <(echo -n) <(gofmt -d .)
7875
- run:
7976
name: Check go vet
8077
command: |

compiler/compiler.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@ import (
2121
"golang.org/x/tools/go/gcexportdata"
2222
)
2323

24-
var sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}
25-
var reservedKeywords = make(map[string]bool)
24+
var (
25+
sizes32 = &types.StdSizes{WordSize: 4, MaxAlign: 8}
26+
reservedKeywords = make(map[string]bool)
27+
)
2628

2729
func init() {
2830
for _, keyword := range []string{"abstract", "arguments", "boolean", "break", "byte", "case", "catch", "char", "class", "const", "continue", "debugger", "default", "delete", "do", "double", "else", "enum", "eval", "export", "extends", "false", "final", "finally", "float", "for", "function", "goto", "if", "implements", "import", "in", "instanceof", "int", "interface", "let", "long", "native", "new", "null", "package", "private", "protected", "public", "return", "short", "static", "super", "switch", "synchronized", "this", "throw", "throws", "transient", "true", "try", "typeof", "undefined", "var", "void", "volatile", "while", "with", "yield"} {

compiler/natives/src/embed/embed.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ func buildFS(list []struct {
77
name string
88
data string
99
hash [16]byte
10-
}) (f FS) {
10+
},
11+
) (f FS) {
1112
n := len(list)
1213
files := make([]file, n)
1314
for i := 0; i < n; i++ {

compiler/natives/src/encoding/gob/gob_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func TestEndToEnd(t *testing.T) {
6868
// TODO: Fix this problem:
6969
// TypeError: dst.$set is not a function
7070
// at typedmemmove (/github.com/gopherjs/gopherjs/reflect.go:487:3)
71-
//Marr: map[[2]string][2]*float64{arr1: floatArr1, arr2: floatArr2},
71+
// Marr: map[[2]string][2]*float64{arr1: floatArr1, arr2: floatArr2},
7272
EmptyMap: make(map[string]int),
7373
N: &[3]float64{1.5, 2.5, 3.5},
7474
Strs: &[2]string{s1, s2},

compiler/natives/src/internal/reflectlite/all_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
package reflectlite_test
55

66
import (
7-
. "internal/reflectlite"
87
"testing"
8+
9+
. "internal/reflectlite"
910
)
1011

1112
func TestTypes(t *testing.T) {

0 commit comments

Comments
 (0)