Skip to content

Commit cdcab31

Browse files
committed
gofmt -s and fix spelling errors.
1 parent 4edf798 commit cdcab31

15 files changed

+67
-56
lines changed

cmd/mrp/main.go

-1
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,6 @@ Options:
943943
os.Exit(1)
944944
} else {
945945
util.PrintError(err, "webserv", "UI disabled")
946-
enableUI = false
947946
listener = nil
948947
}
949948
} else {

martian/core/argument_map.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ func checkType(val json.RawMessage, typename string, arrayDim int,
106106
return true, ""
107107
}
108108
default:
109-
// User defined file types. For backwards compatiblity we need
110-
// to accept everything here.
109+
// User defined file types. For backwards compatibility we
110+
// need to accept everything here.
111111
var v string
112112
if err := json.Unmarshal(val, &v); err != nil {
113113
trunc := val

martian/core/argument_map_test.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ func TestArgumentMapValidateInputs(t *testing.T) {
2424
t.Errorf("Unmarshal failure: %v", err)
2525
}
2626
plist := []*syntax.InParam{
27-
&syntax.InParam{
27+
{
2828
Id: "foo",
2929
Tname: "int",
3030
},
31-
&syntax.InParam{
31+
{
3232
Id: "bar",
3333
Tname: "float",
3434
},
35-
&syntax.InParam{
35+
{
3636
Id: "baz",
3737
Tname: "map",
3838
},
39-
&syntax.InParam{
39+
{
4040
Id: "bing",
4141
Tname: "int",
4242
ArrayDim: 1,
@@ -120,19 +120,19 @@ func TestArgumentMapValidateOutputs(t *testing.T) {
120120
t.Errorf("Unmarshal failure: %v", err)
121121
}
122122
plist := []*syntax.OutParam{
123-
&syntax.OutParam{
123+
{
124124
Id: "foo",
125125
Tname: "int",
126126
},
127-
&syntax.OutParam{
127+
{
128128
Id: "bar",
129129
Tname: "float",
130130
},
131-
&syntax.OutParam{
131+
{
132132
Id: "baz",
133133
Tname: "map",
134134
},
135-
&syntax.OutParam{
135+
{
136136
Id: "bing",
137137
Tname: "int",
138138
ArrayDim: 1,

martian/core/binding.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,11 @@ func (pipestance *Pipestance) retain(ref *syntax.RefExp) {
241241
if children := fileArgs[ref.OutputId]; children != nil {
242242
children[nil] = struct{}{}
243243
} else {
244-
fileArgs[ref.OutputId] = map[Nodable]struct{}{nil: struct{}{}}
244+
fileArgs[ref.OutputId] = map[Nodable]struct{}{nil: {}}
245245
}
246246
} else {
247247
fork.fileArgs = map[string]map[Nodable]struct{}{
248-
ref.OutputId: map[Nodable]struct{}{nil: struct{}{}},
248+
ref.OutputId: {nil: {}},
249249
}
250250
}
251251
}
@@ -261,11 +261,11 @@ func (pipestance *Pipestance) retain(ref *syntax.RefExp) {
261261
if children := fileArgs[ref.OutputId]; children != nil {
262262
children[nil] = struct{}{}
263263
} else {
264-
fileArgs[ref.OutputId] = map[Nodable]struct{}{nil: struct{}{}}
264+
fileArgs[ref.OutputId] = map[Nodable]struct{}{nil: {}}
265265
}
266266
} else {
267267
fork.fileArgs = map[string]map[Nodable]struct{}{
268-
ref.OutputId: map[Nodable]struct{}{nil: struct{}{}},
268+
ref.OutputId: {nil: {}},
269269
}
270270
}
271271
}

martian/core/iostats_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,31 +19,31 @@ func ExampleIoStatsBuilder() {
1919
// 11, 9, and 10 syscalls in the first, second, and third
2020
// 10-second period, respectively.
2121
sb.Update(map[int]*IoAmount{
22-
1: &IoAmount{
22+
1: {
2323
Read: IoValues{Syscalls: 1, BlockBytes: 1024},
2424
Write: IoValues{},
2525
},
26-
2: &IoAmount{
26+
2: {
2727
Read: IoValues{Syscalls: 10, BlockBytes: 1024},
2828
Write: IoValues{},
2929
},
3030
}, t.Add(time.Second*10))
3131
sb.Update(map[int]*IoAmount{
32-
1: &IoAmount{
32+
1: {
3333
Read: IoValues{Syscalls: 10, BlockBytes: 3072},
3434
Write: IoValues{},
3535
},
36-
2: &IoAmount{
36+
2: {
3737
Read: IoValues{Syscalls: 10, BlockBytes: 1024},
3838
Write: IoValues{},
3939
},
4040
}, t.Add(time.Second*20))
4141
sb.Update(map[int]*IoAmount{
42-
1: &IoAmount{
42+
1: {
4343
Read: IoValues{Syscalls: 10, BlockBytes: 4096},
4444
Write: IoValues{},
4545
},
46-
3: &IoAmount{
46+
3: {
4747
Read: IoValues{Syscalls: 10, BlockBytes: 1024},
4848
Write: IoValues{},
4949
},

martian/core/jobmanager_local.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
// The base number of threads assumed per job. This includes the threads used
3939
// by the mrjob process and whatever threads the spawned process uses for
4040
// runtime management. Very approximate since it depends on many details of
41-
// the stage code langauge and implementation. The number of threads reserved
41+
// the stage code language and implementation. The number of threads reserved
4242
// by the job will be added to this number.
4343
procsPerJob = 15
4444
)

martian/core/node.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func (self *Node) attachBindings(bindingList []*Binding) {
224224
for arg := range boundArgs {
225225
if nodes := pArgs[arg]; nodes == nil {
226226
pArgs[arg] = map[Nodable]struct{}{
227-
setNode: struct{}{},
227+
setNode: {},
228228
}
229229
} else {
230230
nodes[setNode] = struct{}{}
@@ -241,7 +241,7 @@ func maybeFileType(tname string) bool {
241241
return tname != "int" && tname != "float" && tname != "bool"
242242
}
243243

244-
// Get the set of distinct precurser nodes and direct precurser nodes based on
244+
// Get the set of distinct precursor nodes and direct precursor nodes based on
245245
// the given binding set.
246246
func recurseBoundNodes(bindingList []*Binding) (prenodes map[string]Nodable,
247247
parents []Nodable,
@@ -271,7 +271,7 @@ func recurseBoundNodes(bindingList []*Binding) (prenodes map[string]Nodable,
271271
if maybeFileType(binding.tname) {
272272
if par := fileParents[binding.boundNode]; par == nil {
273273
fileParents[binding.boundNode] = map[string]struct{}{
274-
binding.output: struct{}{},
274+
binding.output: {},
275275
}
276276
} else {
277277
par[binding.output] = struct{}{}
@@ -859,7 +859,7 @@ func (self *Node) refreshState(readOnly bool) {
859859
meta.endRefresh(startTime)
860860
}
861861
}
862-
for fork, _ := range updatedForks {
862+
for fork := range updatedForks {
863863
fork.printUpdateIfNeeded()
864864
}
865865
}

martian/core/override.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func ReadOverrides(path string) (*PipestanceOverrides, error) {
102102
* cast the return value to the expected type. We'll catch any type
103103
* errors here and prevent mrp from starting. We also want to keep the
104104
* overrides untypes so that GetOverride can operate as a generic
105-
* funciton for all possible types.
105+
* function for all possible types.
106106
*/
107107

108108
for _, stage_override_data := range pse.overridesbystage {

martian/core/pipestance.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func NewStagestance(parent Nodable, callStm *syntax.CallStm, callables *syntax.C
8282
}
8383
if arg := fork.fileArgs[param.Id]; arg == nil {
8484
fork.fileArgs[param.Id] = map[Nodable]struct{}{
85-
nil: struct{}{},
85+
nil: {},
8686
}
8787
} else {
8888
arg[nil] = struct{}{}

martian/core/resource_semaphore.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ func (self *ResourceSemaphore) Acquire(n int64) error {
5959
if n > self.maxSize {
6060
// This can never be served.
6161
self.mu.Unlock()
62-
return fmt.Errorf("Tried to aquire %d %s, when the maximum is %d.",
62+
return fmt.Errorf("Tried to acquire %d %s, when the maximum is %d.",
6363
n, self.Name, self.maxSize)
6464
}
6565

martian/core/resource_semaphore_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ func TestResourceSemaphoreActualRelease(t *testing.T) {
239239
t.Errorf("Expected 80 in use, got %d", sem.InUse())
240240
}
241241
if acq {
242-
t.Errorf("Should not have been able to aquire yet.")
242+
t.Errorf("Should not have been able to acquire yet.")
243243
}
244244
if diff := sem.UpdateActual(25); diff != -75 {
245245
t.Errorf("Expected -75 diff, got %d", diff)

martian/core/runtime_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,16 +40,16 @@ func ExampleBuildCallSource() {
4040
Id: "STAGE_NAME",
4141
InParams: &syntax.InParams{
4242
List: []*syntax.InParam{
43-
&syntax.InParam{
43+
{
4444
Tname: "int",
4545
ArrayDim: 1,
4646
Id: "input1",
4747
},
48-
&syntax.InParam{
48+
{
4949
Tname: "string",
5050
Id: "input2",
5151
},
52-
&syntax.InParam{
52+
{
5353
Tname: "map",
5454
Id: "input3",
5555
},

martian/core/stage.go

+29-17
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ func NewChunk(fork *Fork, index int,
8888
if legacyPath != chunkPath {
8989
if info, err := os.Stat(legacyPath); err == nil && info != nil {
9090
if info.IsDir() {
91-
self.metadata = NewMetadataWithJournalPath(self.fqname, legacyPath, self.fork.node.journalPath)
91+
self.metadata = NewMetadataWithJournalPath(
92+
self.fqname, legacyPath, self.fork.node.journalPath)
9293
}
9394
}
9495
}
@@ -190,9 +191,13 @@ func (self *Chunk) updateState(state MetadataFileName, uniquifier string) {
190191
if state == ProgressFile {
191192
self.fork.lastPrint = time.Now()
192193
if msg, err := self.metadata.readRawSafe(state); err == nil {
193-
util.PrintInfo("runtime", "(progress) %s: %s", self.fqname, msg)
194+
util.PrintInfo("runtime",
195+
"(progress) %s: %s",
196+
self.fqname, msg)
194197
} else {
195-
util.LogError(err, "progres", "Error reading progress file for %s", self.fqname)
198+
util.LogError(err, "progres",
199+
"Error reading progress file for %s",
200+
self.fqname)
196201
}
197202
}
198203
if beginState == Running || beginState == Queued {
@@ -222,7 +227,7 @@ func (self *Chunk) step(bindings LazyArgumentMap) {
222227
// Resolve input argument bindings and merge in the chunk defs.
223228
resolvedBindings := self.chunkDef.Merge(bindings)
224229

225-
// Write out input and ouput args for the chunk.
230+
// Write out input and output args for the chunk.
226231
self.metadata.Write(ArgsFile, resolvedBindings)
227232
outs := makeOutArgs(self.fork.OutParams(), self.metadata.curFilesPath, false)
228233
if self.fork.Split() {
@@ -332,8 +337,10 @@ func NewFork(nodable Nodable, index int, argPermute map[string]interface{}) *For
332337
self.path = path.Join(self.node.path, fmt.Sprintf("fork%d", index))
333338
self.fqname = self.node.fqname + fmt.Sprintf(".fork%d", index)
334339
self.metadata = NewMetadata(self.fqname, self.path)
335-
self.split_metadata = NewMetadata(self.fqname+".split", path.Join(self.path, "split"))
336-
self.join_metadata = NewMetadata(self.fqname+".join", path.Join(self.path, "join"))
340+
self.split_metadata = NewMetadata(self.fqname+".split",
341+
path.Join(self.path, "split"))
342+
self.join_metadata = NewMetadata(self.fqname+".join",
343+
path.Join(self.path, "join"))
337344
if self.Split() {
338345
self.split_metadata.discoverUniquify()
339346
self.join_metadata.finalFilePath = self.metadata.finalFilePath
@@ -674,9 +681,13 @@ func (self *Fork) updateState(state, uniquifier string) {
674681
if state == string(ProgressFile) {
675682
self.lastPrint = time.Now()
676683
if msg, err := self.metadata.readRawSafe(MetadataFileName(state)); err == nil {
677-
util.PrintInfo("runtime", "(progress) %s: %s", self.fqname, msg)
684+
util.PrintInfo("runtime",
685+
"(progress) %s: %s",
686+
self.fqname, msg)
678687
} else {
679-
util.LogError(err, "progres", "Error reading progress file for %s", self.fqname)
688+
util.LogError(err, "progres",
689+
"Error reading progress file for %s",
690+
self.fqname)
680691
}
681692
}
682693
if strings.HasPrefix(state, SplitPrefix) {
@@ -801,12 +812,10 @@ func (self *Fork) step() {
801812
}
802813
if self.split_metadata.exists(StageDefsFile) {
803814
if err := self.split_metadata.ReadInto(StageDefsFile, &self.stageDefs); err != nil {
804-
errstring := "none"
805-
if err != nil {
806-
errstring = err.Error()
807-
}
808-
self.split_metadata.WriteRaw(Errors,
809-
fmt.Sprintf("The split method did not return a dictionary {'chunks': [{}], 'join': {}}.\nError: %s\nChunk count: %d", errstring, len(self.stageDefs.ChunkDefs)))
815+
errstring := err.Error()
816+
self.split_metadata.WriteRaw(Errors, fmt.Sprintf(
817+
"The split method did not return a dictionary {'chunks': [{}], 'join': {}}.\nError: %s\nChunk count: %d",
818+
errstring, len(self.stageDefs.ChunkDefs)))
810819
} else if len(self.stageDefs.ChunkDefs) == 0 {
811820
// Skip the chunk phase.
812821
state = Complete.Prefixed(ChunksPrefix)
@@ -933,9 +942,11 @@ func (self *Fork) step() {
933942
if alarms.Len() > 0 {
934943
self.lastPrint = time.Now()
935944
if len(self.node.forks) > 1 {
936-
util.Print("Alerts for %s.fork%d:\n%s\n", self.node.fqname, self.index, alarms.String())
945+
util.Print("Alerts for %s.fork%d:\n%s\n",
946+
self.node.fqname, self.index, alarms.String())
937947
} else {
938-
util.Print("Alerts for %s:\n%s\n", self.node.fqname, alarms.String())
948+
util.Print("Alerts for %s:\n%s\n",
949+
self.node.fqname, alarms.String())
939950
}
940951
}
941952
} else {
@@ -962,7 +973,8 @@ func (self *Fork) step() {
962973
self.writeInvocation()
963974
if outs, err := resolveBindings(self.node.retbindings, self.argPermute,
964975
self.node.rt.FreeMemBytes()/int64(len(self.node.prenodes)+1)); err != nil {
965-
util.PrintError(err, "runtime", "Error resolving output argument bindings.")
976+
util.PrintError(err, "runtime",
977+
"Error resolving output argument bindings.")
966978
self.metadata.WriteRaw(Errors, err.Error())
967979
} else {
968980
self.metadata.Write(OutsFile, outs)

martian/core/storage.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ func getArgsToFilesMap(fileArgs map[string]map[Nodable]struct{},
357357
for _, fullName := range getLogicalFileNames(name) {
358358
fileSet := argToFiles[arg]
359359
if fileSet == nil {
360-
fileSet = map[string]struct{}{fullName: struct{}{}}
360+
fileSet = map[string]struct{}{fullName: {}}
361361
argToFiles[arg] = fileSet
362362
} else {
363363
fileSet[fullName] = struct{}{}
@@ -413,7 +413,7 @@ func addFilesToArgsMappings(fpath string, debug bool, fqname string,
413413
}
414414

415415
if entry.args == nil {
416-
entry.args = map[string]struct{}{arg: struct{}{}}
416+
entry.args = map[string]struct{}{arg: {}}
417417
} else {
418418
entry.args[arg] = struct{}{}
419419
}

martian/syntax/compile_stages.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ const (
8787
// only the list is set.
8888
var modParams = InParams{
8989
Table: map[string]*InParam{
90-
disabled: &InParam{Id: disabled, Tname: "bool"},
91-
local: &InParam{Id: local, Tname: "bool"},
92-
preflight: &InParam{Id: preflight, Tname: "bool"},
93-
volatile: &InParam{Id: volatile, Tname: "bool"},
90+
disabled: {Id: disabled, Tname: "bool"},
91+
local: {Id: local, Tname: "bool"},
92+
preflight: {Id: preflight, Tname: "bool"},
93+
volatile: {Id: volatile, Tname: "bool"},
9494
},
9595
}
9696

0 commit comments

Comments
 (0)