Unverified Commit c7d4b8d3 authored by Steven Allen's avatar Steven Allen Committed by GitHub

Merge pull request #7900 from mvdan/gofmt-s

all: gofmt -s
parents 884a5aeb 82e66740
//go:generate git submodule update --init ./dir-index-html //go:generate git submodule update --init ./dir-index-html
//go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -mode=0644 -modtime=1403768328 -pkg=assets init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt //go:generate go run github.com/go-bindata/go-bindata/v3/go-bindata -mode=0644 -modtime=1403768328 -pkg=assets init-doc dir-index-html/dir-index.html dir-index-html/knownIcons.txt
//go:generate gofmt -w bindata.go //go:generate gofmt -s -w bindata.go
//go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go" //go:generate sh -c "sed -i \"s/.*BindataVersionHash.*/BindataVersionHash=\\\"$(git hash-object bindata.go)\\\"/\" bindata_version_hash.go"
//go:generate gofmt -w bindata_version_hash.go //go:generate gofmt -s -w bindata_version_hash.go
package assets package assets
import ( import (
......
...@@ -370,18 +370,18 @@ type bintree struct { ...@@ -370,18 +370,18 @@ type bintree struct {
} }
var _bintree = &bintree{nil, map[string]*bintree{ var _bintree = &bintree{nil, map[string]*bintree{
"dir-index-html": &bintree{nil, map[string]*bintree{ "dir-index-html": {nil, map[string]*bintree{
"dir-index.html": &bintree{dirIndexHtmlDirIndexHtml, map[string]*bintree{}}, "dir-index.html": {dirIndexHtmlDirIndexHtml, map[string]*bintree{}},
"knownIcons.txt": &bintree{dirIndexHtmlKnowniconsTxt, map[string]*bintree{}}, "knownIcons.txt": {dirIndexHtmlKnowniconsTxt, map[string]*bintree{}},
}}, }},
"init-doc": &bintree{nil, map[string]*bintree{ "init-doc": {nil, map[string]*bintree{
"about": &bintree{initDocAbout, map[string]*bintree{}}, "about": {initDocAbout, map[string]*bintree{}},
"contact": &bintree{initDocContact, map[string]*bintree{}}, "contact": {initDocContact, map[string]*bintree{}},
"help": &bintree{initDocHelp, map[string]*bintree{}}, "help": {initDocHelp, map[string]*bintree{}},
"ping": &bintree{initDocPing, map[string]*bintree{}}, "ping": {initDocPing, map[string]*bintree{}},
"quick-start": &bintree{initDocQuickStart, map[string]*bintree{}}, "quick-start": {initDocQuickStart, map[string]*bintree{}},
"readme": &bintree{initDocReadme, map[string]*bintree{}}, "readme": {initDocReadme, map[string]*bintree{}},
"security-notes": &bintree{initDocSecurityNotes, map[string]*bintree{}}, "security-notes": {initDocSecurityNotes, map[string]*bintree{}},
}}, }},
}} }}
......
...@@ -4,7 +4,7 @@ T="$(mktemp)" ...@@ -4,7 +4,7 @@ T="$(mktemp)"
find . \ find . \
-path ./test/sharness -prune \ -path ./test/sharness -prune \
-o -path ./plugin/loader/preload.go -prune \ -o -path ./plugin/loader/preload.go -prune \
-o -name '*.go' -print0 | xargs -0 gofmt -l > "$T" -o -name '*.go' -print0 | xargs -0 gofmt -s -l > "$T"
if [ -n "$(cat $T)" ]; then if [ -n "$(cat $T)" ]; then
echo "Following Go code is not formatted." echo "Following Go code is not formatted."
......
...@@ -682,7 +682,7 @@ func pinVerify(ctx context.Context, n *core.IpfsNode, opts pinVerifyOpts, enc ci ...@@ -682,7 +682,7 @@ func pinVerify(ctx context.Context, n *core.IpfsNode, opts pinVerifyOpts, enc ci
if err := verifcid.ValidateCid(root); err != nil { if err := verifcid.ValidateCid(root); err != nil {
status := PinStatus{Ok: false} status := PinStatus{Ok: false}
if opts.explain { if opts.explain {
status.BadNodes = []BadNode{BadNode{Cid: enc.Encode(key), Err: err.Error()}} status.BadNodes = []BadNode{{Cid: enc.Encode(key), Err: err.Error()}}
} }
visited[key] = status visited[key] = status
return status return status
...@@ -692,7 +692,7 @@ func pinVerify(ctx context.Context, n *core.IpfsNode, opts pinVerifyOpts, enc ci ...@@ -692,7 +692,7 @@ func pinVerify(ctx context.Context, n *core.IpfsNode, opts pinVerifyOpts, enc ci
if err != nil { if err != nil {
status := PinStatus{Ok: false} status := PinStatus{Ok: false}
if opts.explain { if opts.explain {
status.BadNodes = []BadNode{BadNode{Cid: enc.Encode(key), Err: err.Error()}} status.BadNodes = []BadNode{{Cid: enc.Encode(key), Err: err.Error()}}
} }
visited[key] = status visited[key] = status
return status return status
......
...@@ -166,7 +166,7 @@ var VersionROCmd = &cmds.Command{} ...@@ -166,7 +166,7 @@ var VersionROCmd = &cmds.Command{}
var rootROSubcommands = map[string]*cmds.Command{ var rootROSubcommands = map[string]*cmds.Command{
"commands": CommandsDaemonROCmd, "commands": CommandsDaemonROCmd,
"cat": CatCmd, "cat": CatCmd,
"block": &cmds.Command{ "block": {
Subcommands: map[string]*cmds.Command{ Subcommands: map[string]*cmds.Command{
"stat": blockStatCmd, "stat": blockStatCmd,
"get": blockGetCmd, "get": blockGetCmd,
......
...@@ -3,9 +3,9 @@ package namesys ...@@ -3,9 +3,9 @@ package namesys
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"net" "net"
"strings" "strings"
"fmt"
path "github.com/ipfs/go-path" path "github.com/ipfs/go-path"
opts "github.com/ipfs/interface-go-ipfs-core/options/namesys" opts "github.com/ipfs/interface-go-ipfs-core/options/namesys"
......
...@@ -61,72 +61,72 @@ func TestDnsEntryParsing(t *testing.T) { ...@@ -61,72 +61,72 @@ func TestDnsEntryParsing(t *testing.T) {
func newMockDNS() *mockDNS { func newMockDNS() *mockDNS {
return &mockDNS{ return &mockDNS{
entries: map[string][]string{ entries: map[string][]string{
"multihash.example.com.": []string{ "multihash.example.com.": {
"dnslink=QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"ipfs.example.com.": []string{ "ipfs.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"_dnslink.dipfs.example.com.": []string{ "_dnslink.dipfs.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"dns1.example.com.": []string{ "dns1.example.com.": {
"dnslink=/ipns/ipfs.example.com", "dnslink=/ipns/ipfs.example.com",
}, },
"dns2.example.com.": []string{ "dns2.example.com.": {
"dnslink=/ipns/dns1.example.com", "dnslink=/ipns/dns1.example.com",
}, },
"multi.example.com.": []string{ "multi.example.com.": {
"some stuff", "some stuff",
"dnslink=/ipns/dns1.example.com", "dnslink=/ipns/dns1.example.com",
"masked dnslink=/ipns/example.invalid", "masked dnslink=/ipns/example.invalid",
}, },
"equals.example.com.": []string{ "equals.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/=equals", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/=equals",
}, },
"loop1.example.com.": []string{ "loop1.example.com.": {
"dnslink=/ipns/loop2.example.com", "dnslink=/ipns/loop2.example.com",
}, },
"loop2.example.com.": []string{ "loop2.example.com.": {
"dnslink=/ipns/loop1.example.com", "dnslink=/ipns/loop1.example.com",
}, },
"_dnslink.dloop1.example.com.": []string{ "_dnslink.dloop1.example.com.": {
"dnslink=/ipns/loop2.example.com", "dnslink=/ipns/loop2.example.com",
}, },
"_dnslink.dloop2.example.com.": []string{ "_dnslink.dloop2.example.com.": {
"dnslink=/ipns/loop1.example.com", "dnslink=/ipns/loop1.example.com",
}, },
"bad.example.com.": []string{ "bad.example.com.": {
"dnslink=", "dnslink=",
}, },
"withsegment.example.com.": []string{ "withsegment.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/segment",
}, },
"withrecsegment.example.com.": []string{ "withrecsegment.example.com.": {
"dnslink=/ipns/withsegment.example.com/subsub", "dnslink=/ipns/withsegment.example.com/subsub",
}, },
"withtrailing.example.com.": []string{ "withtrailing.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD/sub/",
}, },
"withtrailingrec.example.com.": []string{ "withtrailingrec.example.com.": {
"dnslink=/ipns/withtrailing.example.com/segment/", "dnslink=/ipns/withtrailing.example.com/segment/",
}, },
"double.example.com.": []string{ "double.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"_dnslink.double.example.com.": []string{ "_dnslink.double.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"double.conflict.com.": []string{ "double.conflict.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjD",
}, },
"_dnslink.conflict.example.com.": []string{ "_dnslink.conflict.example.com.": {
"dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjE", "dnslink=/ipfs/QmY3hE8xgFCjGcz6PHgnvJz5HZi1BaKRfPkn1ghZUcYMjE",
}, },
"fqdn.example.com.": []string{ "fqdn.example.com.": {
"dnslink=/ipfs/QmYvMB9yrsSf7RKBghkfwmHJkzJhW2ZgVwq3LxBXXPasFr", "dnslink=/ipfs/QmYvMB9yrsSf7RKBghkfwmHJkzJhW2ZgVwq3LxBXXPasFr",
}, },
"www.wealdtech.eth.link.": []string{ "www.wealdtech.eth.link.": {
"dnslink=/ipns/ipfs.example.com", "dnslink=/ipns/ipfs.example.com",
}, },
}, },
......
#!/bin/sh
#TODO add go lint and go vet
verify_gofmt() {
GOFMT="gofmt -s"
cd "$(git rev-parse --show-toplevel)"
bad_files=$($GOFMT -l .)
cd -
if [[ -n $bad_files ]]; then
echo "You have to run '$GOFMT' on these files:"
echo "$bad_files"
false
else
true
fi
}
verify_gofmt
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment