Skip to content

Commit

Permalink
many: run gofmt -s -w on all the code
Browse files Browse the repository at this point in the history
Signed-off-by: Zygmunt Krynicki <[email protected]>
  • Loading branch information
zyga committed Nov 22, 2016
1 parent 452c8ba commit 71bfcb6
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 79 deletions.
4 changes: 2 additions & 2 deletions asserts/account_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ var _ consistencyChecker = (*AccountKey)(nil)
// Prerequisites returns references to this account-key's prerequisite assertions.
func (ak *AccountKey) Prerequisites() []*Ref {
return []*Ref{
&Ref{Type: AccountType, PrimaryKey: []string{ak.AccountID()}},
{Type: AccountType, PrimaryKey: []string{ak.AccountID()}},
}
}

Expand Down Expand Up @@ -245,7 +245,7 @@ var (
// Prerequisites returns references to this account-key-request's prerequisite assertions.
func (akr *AccountKeyRequest) Prerequisites() []*Ref {
return []*Ref{
&Ref{Type: AccountType, PrimaryKey: []string{akr.AccountID()}},
{Type: AccountType, PrimaryKey: []string{akr.AccountID()}},
}
}

Expand Down
2 changes: 1 addition & 1 deletion asserts/membackstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (br memBSBranch) search(hint []string, found func(Assertion), maxFormat int
func (leaf memBSLeaf) search(hint []string, found func(Assertion), maxFormat int) {
hint0 := hint[0]
if hint0 == "" {
for key, _ := range leaf {
for key := range leaf {
cand := leaf.cur(key, maxFormat)
if cand != nil {
found(cand)
Expand Down
10 changes: 5 additions & 5 deletions asserts/snap_asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ var _ consistencyChecker = (*SnapDeclaration)(nil)
// Prerequisites returns references to this snap-declaration's prerequisite assertions.
func (snapdcl *SnapDeclaration) Prerequisites() []*Ref {
return []*Ref{
&Ref{Type: AccountType, PrimaryKey: []string{snapdcl.PublisherID()}},
{Type: AccountType, PrimaryKey: []string{snapdcl.PublisherID()}},
}
}

Expand Down Expand Up @@ -332,8 +332,8 @@ var _ consistencyChecker = (*SnapRevision)(nil)
func (snaprev *SnapRevision) Prerequisites() []*Ref {
return []*Ref{
// XXX: mediate getting current series through some context object? this gets the job done for now
&Ref{Type: SnapDeclarationType, PrimaryKey: []string{release.Series, snaprev.SnapID()}},
&Ref{Type: AccountType, PrimaryKey: []string{snaprev.DeveloperID()}},
{Type: SnapDeclarationType, PrimaryKey: []string{release.Series, snaprev.SnapID()}},
{Type: AccountType, PrimaryKey: []string{snaprev.DeveloperID()}},
}
}

Expand Down Expand Up @@ -457,8 +457,8 @@ var _ consistencyChecker = (*Validation)(nil)
// Prerequisites returns references to this validation's prerequisite assertions.
func (validation *Validation) Prerequisites() []*Ref {
return []*Ref{
&Ref{Type: SnapDeclarationType, PrimaryKey: []string{validation.Series(), validation.SnapID()}},
&Ref{Type: SnapDeclarationType, PrimaryKey: []string{validation.Series(), validation.ApprovedSnapID()}},
{Type: SnapDeclarationType, PrimaryKey: []string{validation.Series(), validation.SnapID()}},
{Type: SnapDeclarationType, PrimaryKey: []string{validation.Series(), validation.ApprovedSnapID()}},
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/snap/cmd_delete_key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (s *SnapKeysSuite) TestDeleteKey(c *C) {
c.Check(s.Stderr(), Equals, "")
_, err = snap.Parser().ParseArgs([]string{"keys", "--json"})
expectedResponse := []snap.Key{
snap.Key{
{
Name: "default",
Sha3_384: "g4Pks54W_US4pZuxhgG_RHNAf_UeZBBuZyGRLLmMj1Do3GkE_r_5A5BFjx24ZwVJ",
},
Expand Down
4 changes: 2 additions & 2 deletions cmd/snap/cmd_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ func (s *SnapKeysSuite) TestKeysJSON(c *C) {
c.Assert(err, IsNil)
c.Assert(rest, DeepEquals, []string{})
expectedResponse := []snap.Key{
snap.Key{
{
Name: "default",
Sha3_384: "g4Pks54W_US4pZuxhgG_RHNAf_UeZBBuZyGRLLmMj1Do3GkE_r_5A5BFjx24ZwVJ",
},
snap.Key{
{
Name: "another",
Sha3_384: "DVQf1U4mIsuzlQqAebjjTPYtYJ-GEhJy0REuj3zvpQYTZ7EJj7adBxIXLJ7Vmk3L",
},
Expand Down
2 changes: 1 addition & 1 deletion i18n/xgettext-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func constructValue(val interface{}) string {
left = left[0 : len(left)-1]
right := constructValue(val.(*ast.BinaryExpr).Y)
// strip left " (or `)
right = right[1:len(right)]
right = right[1:]
return left + right
default:
panic(fmt.Sprintf("unknown type: %v", val))
Expand Down
28 changes: 14 additions & 14 deletions i18n/xgettext-go/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func main() {
c.Assert(err, IsNil)

c.Assert(msgIDs, DeepEquals, map[string][]msgID{
"foo": []msgID{
"foo": {
{
comment: "#. TRANSLATORS: foo comment\n",
fname: fname,
Expand All @@ -116,7 +116,7 @@ func main() {
c.Assert(err, IsNil)

c.Assert(msgIDs, DeepEquals, map[string][]msgID{
"foo": []msgID{
"foo": {
{
comment: "#. TRANSLATORS: foo comment\n",
fname: fname,
Expand Down Expand Up @@ -152,7 +152,7 @@ msgstr "Project-Id-Version: snappy\n"

func (s *xgettextTestSuite) TestWriteOutputSimple(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
fname: "fname",
line: 2,
Expand All @@ -175,7 +175,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputMultiple(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
fname: "fname",
line: 2,
Expand Down Expand Up @@ -204,7 +204,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputNoComment(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
fname: "fname",
line: 2,
Expand All @@ -225,7 +225,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputNoLocation(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
fname: "fname",
line: 2,
Expand All @@ -247,7 +247,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputFormatHint(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
fname: "fname",
line: 2,
Expand All @@ -271,7 +271,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputPlural(c *C) {
msgIDs = map[string][]msgID{
"foo": []msgID{
"foo": {
{
msgidPlural: "plural",
fname: "fname",
Expand All @@ -296,13 +296,13 @@ msgstr[1] ""

func (s *xgettextTestSuite) TestWriteOutputSorted(c *C) {
msgIDs = map[string][]msgID{
"aaa": []msgID{
"aaa": {
{
fname: "fname",
line: 2,
},
},
"zzz": []msgID{
"zzz": {
{
fname: "fname",
line: 2,
Expand Down Expand Up @@ -403,7 +403,7 @@ func main() {
c.Assert(err, IsNil)

c.Assert(msgIDs, DeepEquals, map[string][]msgID{
"foo\\nbar\\nbaz": []msgID{
"foo\\nbar\\nbaz": {
{
comment: "#. TRANSLATORS: foo comment\n",
fname: fname,
Expand Down Expand Up @@ -438,7 +438,7 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputMultilines(c *C) {
msgIDs = map[string][]msgID{
"foo\\nbar\\nbaz": []msgID{
"foo\\nbar\\nbaz": {
{
fname: "fname",
line: 2,
Expand All @@ -462,13 +462,13 @@ msgstr ""

func (s *xgettextTestSuite) TestWriteOutputTidy(c *C) {
msgIDs = map[string][]msgID{
"foo\\nbar\\nbaz": []msgID{
"foo\\nbar\\nbaz": {
{
fname: "fname",
line: 2,
},
},
"zzz\\n": []msgID{
"zzz\\n": {
{
fname: "fname",
line: 4,
Expand Down
42 changes: 21 additions & 21 deletions interfaces/builtin/basedeclaration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,27 +345,27 @@ var (

slotInstallation = map[string][]string{
// other
"bluez": []string{"app"},
"bool-file": []string{"core", "gadget"},
"browser-support": []string{"core"},
"content": []string{"app", "gadget"},
"docker-support": []string{"core"},
"fwupd": []string{"app"},
"gpio": []string{"core", "gadget"},
"hidraw": []string{"core", "gadget"},
"i2c": []string{"core", "gadget"},
"location-control": []string{"app"},
"location-observe": []string{"app"},
"lxd-support": []string{"core"},
"mir": []string{"app"},
"modem-manager": []string{"app", "core"},
"mpris": []string{"app"},
"network-manager": []string{"app", "core"},
"ofono": []string{"app", "core"},
"ppp": []string{"core"},
"pulseaudio": []string{"app", "core"},
"serial-port": []string{"core", "gadget"},
"udisks2": []string{"app"},
"bluez": {"app"},
"bool-file": {"core", "gadget"},
"browser-support": {"core"},
"content": {"app", "gadget"},
"docker-support": {"core"},
"fwupd": {"app"},
"gpio": {"core", "gadget"},
"hidraw": {"core", "gadget"},
"i2c": {"core", "gadget"},
"location-control": {"app"},
"location-observe": {"app"},
"lxd-support": {"core"},
"mir": {"app"},
"modem-manager": {"app", "core"},
"mpris": {"app"},
"network-manager": {"app", "core"},
"ofono": {"app", "core"},
"ppp": {"core"},
"pulseaudio": {"app", "core"},
"serial-port": {"core", "gadget"},
"udisks2": {"app"},
// snowflakes
"docker": nil,
"lxd": nil,
Expand Down
2 changes: 1 addition & 1 deletion interfaces/builtin/gpio.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ func (iface *GpioInterface) ConnectedSlotRichSnippet(plug *interfaces.Plug, slot
serviceName := interfaces.InterfaceServiceName(slot.Snap.Name(), fmt.Sprintf("gpio-%d", gpioNum))
snippet := &systemd.Snippet{
Services: map[string]systemd.Service{
serviceName: systemd.Service{
serviceName: {
Type: "oneshot",
RemainAfterExit: true,
ExecStart: fmt.Sprintf("/bin/sh -c 'test -e /sys/class/gpio/gpio%d || echo %d > /sys/class/gpio/export'", gpioNum, gpioNum),
Expand Down
26 changes: 13 additions & 13 deletions interfaces/systemd/backend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,21 @@ func (s *backendSuite) TestName(c *C) {

func (s *backendSuite) TestUnmarshalRawSnippetMap(c *C) {
rawSnippetMap := map[string][][]byte{
"security-tag": [][]byte{
"security-tag": {
[]byte(`{"services": {"foo.service": {"exec-start": "/bin/true"}}}`),
[]byte(`{"services": {"bar.service": {"exec-start": "/bin/false"}}}`),
},
}
richSnippetMap, err := systemd.UnmarshalRawSnippetMap(rawSnippetMap)
c.Assert(err, IsNil)
c.Assert(richSnippetMap, DeepEquals, map[string][]*systemd.Snippet{
"security-tag": []*systemd.Snippet{
&systemd.Snippet{
"security-tag": {
{
Services: map[string]systemd.Service{
"foo.service": {ExecStart: "/bin/true"},
},
},
&systemd.Snippet{
{
Services: map[string]systemd.Service{
"bar.service": {ExecStart: "/bin/false"},
},
Expand All @@ -85,15 +85,15 @@ func (s *backendSuite) TestUnmarshalRawSnippetMap(c *C) {

func (s *backendSuite) TestMergeSnippetMapOK(c *C) {
snippetMap := map[string][]*systemd.Snippet{
"security-tag": []*systemd.Snippet{
&systemd.Snippet{
"security-tag": {
{
Services: map[string]systemd.Service{
"foo.service": {ExecStart: "/bin/true"},
},
},
},
"another-tag": []*systemd.Snippet{
&systemd.Snippet{
"another-tag": {
{
Services: map[string]systemd.Service{
"bar.service": {ExecStart: "/bin/false"},
},
Expand All @@ -112,15 +112,15 @@ func (s *backendSuite) TestMergeSnippetMapOK(c *C) {

func (s *backendSuite) TestMergeSnippetMapClashing(c *C) {
snippetMap := map[string][]*systemd.Snippet{
"security-tag": []*systemd.Snippet{
&systemd.Snippet{
"security-tag": {
{
Services: map[string]systemd.Service{
"foo.service": {ExecStart: "/bin/true"},
},
},
},
"another-tag": []*systemd.Snippet{
&systemd.Snippet{
"another-tag": {
{
Services: map[string]systemd.Service{
"foo.service": {ExecStart: "/bin/evil"},
},
Expand All @@ -141,7 +141,7 @@ func (s *backendSuite) TestRenderSnippet(c *C) {
content, err := systemd.RenderSnippet(snippet)
c.Assert(err, IsNil)
c.Assert(content, DeepEquals, map[string]*osutil.FileState{
"foo.service": &osutil.FileState{
"foo.service": {
Content: []byte("[Service]\nExecStart=/bin/true\n\n[Install]\nWantedBy=multi-user.target\n"),
Mode: 0644,
},
Expand Down
2 changes: 1 addition & 1 deletion overlord/auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ func Users(st *state.State) ([]*UserState, error) {
}

users := make([]*UserState, len(authStateData.Users))
for i, _ := range authStateData.Users {
for i := range authStateData.Users {
users[i] = &authStateData.Users[i]
}
return users, nil
Expand Down
2 changes: 1 addition & 1 deletion overlord/patch/patch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (s *patchSuite) TestError(c *C) {
func (s *patchSuite) TestSanity(c *C) {
patches := patch.PatchesForTest()
levels := make([]int, 0, len(patches))
for l, _ := range patches {
for l := range patches {
levels = append(levels, l)
}
sort.Ints(levels)
Expand Down
Loading

0 comments on commit 71bfcb6

Please sign in to comment.