Skip to content

Commit

Permalink
Merge pull request zimmski#67 from zimmski/gofmt-s
Browse files Browse the repository at this point in the history
Simplify Go code with `gofmt -s`
  • Loading branch information
zimmski authored Nov 1, 2018
2 parents 4e8457f + e72b50e commit da0dc4f
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"go.formatFlags": [
"-s"
]
}
2 changes: 1 addition & 1 deletion mutator/branch/mutatecase.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func MutatorCase(pkg *types.Package, info *types.Info, node ast.Node) []mutator.
old := n.Body

return []mutator.Mutation{
mutator.Mutation{
{
Change: func() {
n.Body = []ast.Stmt{
astutil.CreateNoopOfStatements(pkg, info, n.Body),
Expand Down
2 changes: 1 addition & 1 deletion mutator/branch/mutateelse.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func MutatorElse(pkg *types.Package, info *types.Info, node ast.Node) []mutator.
old := n.Else

return []mutator.Mutation{
mutator.Mutation{
{
Change: func() {
n.Else = astutil.CreateNoopOfStatement(pkg, info, old)
},
Expand Down
2 changes: 1 addition & 1 deletion mutator/branch/mutateif.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func MutatorIf(pkg *types.Package, info *types.Info, node ast.Node) []mutator.Mu
old := n.Body.List

return []mutator.Mutation{
mutator.Mutation{
{
Change: func() {
n.Body.List = []ast.Stmt{
astutil.CreateNoopOfStatement(pkg, info, n.Body),
Expand Down
4 changes: 2 additions & 2 deletions mutator/expression/remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ func MutatorRemoveTerm(pkg *types.Package, info *types.Info, node ast.Node) []mu
y := n.Y

return []mutator.Mutation{
mutator.Mutation{
{
Change: func() {
n.X = r
},
Reset: func() {
n.X = x
},
},
mutator.Mutation{
{
Change: func() {
n.Y = r
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [ -z ${PKG+x} ]; then echo "PKG is not set"; exit 1; fi
if [ -z ${ROOT_DIR+x} ]; then echo "ROOT_DIR is not set"; exit 1; fi

echo "gofmt:"
OUT=$(gofmt -l $ROOT_DIR 2>&1 | grep --invert-match -E "(/example)")
OUT=$(gofmt -l -s $ROOT_DIR 2>&1 | grep --invert-match -E "(/example)")
if [ -n "$OUT" ]; then echo "$OUT"; PROBLEM=1; fi

echo "errcheck:"
Expand Down

0 comments on commit da0dc4f

Please sign in to comment.