gofmt all

This commit is contained in:
John Kerl 2020-08-27 08:32:18 -04:00
parent 0ad05df17c
commit 457703b6b6
14 changed files with 31 additions and 24 deletions

3
go/fmter Executable file
View file

@ -0,0 +1,3 @@
#!/bin/bash
for x in $(lsr \*.go); do gofmt -w $x; done

View file

@ -60,7 +60,7 @@ func maybeProfile(cpuprofile *string) {
if err := pprof.StartCPUProfile(f); err != nil {
log.Fatal("Could not start CPU profile: ", err)
}
defer pprof.StopCPUProfile()
defer pprof.StopCPUProfile()
}
}

View file

@ -53,15 +53,15 @@ import (
// ----------------------------------------------------------------
type Lrec struct {
FieldCount int
Head *lrecEntry
Tail *lrecEntry
Head *lrecEntry
Tail *lrecEntry
}
type lrecEntry struct {
Key *string
Value *string
Prev *lrecEntry
Next *lrecEntry
Prev *lrecEntry
Next *lrecEntry
}
// ----------------------------------------------------------------

View file

@ -16,7 +16,7 @@ type RecordReaderDKVP struct {
}
func NewRecordReaderDKVP(ifs string, ips string) *RecordReaderDKVP {
return &RecordReaderDKVP {
return &RecordReaderDKVP{
ifs,
ips,
}
@ -64,7 +64,7 @@ func lrecFromDKVPLine(
) *containers.Lrec {
lrec := containers.LrecAlloc()
pairs := strings.Split(*line, *ifs)
for _, pair := range(pairs) {
for _, pair := range pairs {
kv := strings.SplitN(pair, *ips, 2)
// xxx range-check
key := kv[0]

View file

@ -1,7 +1,10 @@
package input
func Create(inputFormatName string) RecordReader {
switch inputFormatName {
case "dkvp": return NewRecordReaderDKVP(",", "=") // TODO: parameterize
default: return nil
case "dkvp":
return NewRecordReaderDKVP(",", "=") // TODO: parameterize
default:
return nil
}
}

View file

@ -9,8 +9,7 @@ type MapperCat struct {
}
func NewMapperCat() *MapperCat {
return &MapperCat {
}
return &MapperCat{}
}
func (this *MapperCat) Name() string {

View file

@ -9,8 +9,7 @@ type MapperFoo struct {
}
func NewMapperFoo() *MapperFoo {
return &MapperFoo {
}
return &MapperFoo{}
}
func (this *MapperFoo) Name() string {

View file

@ -9,8 +9,7 @@ type MapperNothing struct {
}
func NewMapperNothing() *MapperNothing {
return &MapperNothing {
}
return &MapperNothing{}
}
func (this *MapperNothing) Name() string {

View file

@ -12,7 +12,7 @@ type MapperTac struct {
}
func NewMapperTac() *MapperTac {
return &MapperTac {
return &MapperTac{
list.New(),
}
}

View file

@ -2,9 +2,13 @@ package mapping
func Create(mapperName string) RecordMapper {
switch mapperName {
case "cat": return NewMapperCat()
case "nothing": return NewMapperNothing()
case "tac": return NewMapperTac()
default: return nil
case "cat":
return NewMapperCat()
case "nothing":
return NewMapperNothing()
case "tac":
return NewMapperTac()
default:
return nil
}
}

View file

@ -10,7 +10,7 @@ import (
// ostream *os.File in constructors/factory
type RecordWriterCSV struct {
onFirst bool
onFirst bool
csvWriter *csv.Writer
}

View file

@ -16,7 +16,7 @@ type RecordWriterDKVP struct {
}
func NewRecordWriterDKVP(ifs string, ips string) *RecordWriterDKVP {
return &RecordWriterDKVP {
return &RecordWriterDKVP{
ifs,
ips,
"\n", // TODO: parameterize

View file

@ -15,7 +15,7 @@ type RecordWriterNIDX struct {
}
func NewRecordWriterNIDX(ifs string) *RecordWriterNIDX {
return &RecordWriterNIDX {
return &RecordWriterNIDX{
ifs,
"\n", // TODO: parameterize
}

View file

@ -14,7 +14,7 @@ type RecordWriterXTAB struct {
}
func NewRecordWriterXTAB() *RecordWriterXTAB {
return &RecordWriterXTAB {
return &RecordWriterXTAB{
true,
}
}