Skip to content

Commit 9af5f93

Browse files
committed
Run gofmt
1 parent 5bd9309 commit 9af5f93

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

cmd/protoscope/main.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
1615
package main
1716

1817
import (
@@ -27,10 +26,10 @@ import (
2726
)
2827

2928
var (
30-
outPath = flag.String("o", "", "output file to use (defaults to stdout)")
29+
outPath = flag.String("o", "", "output file to use (defaults to stdout)")
3130
assemble = flag.Bool("s", false, "whether to treat the input as a Protoscope source file")
3231

33-
noQuotedStrings = flag.Bool("no-quoted-strings", false, "assume no fields in the input proto are strings")
32+
noQuotedStrings = flag.Bool("no-quoted-strings", false, "assume no fields in the input proto are strings")
3433
allFieldsAreMessages = flag.Bool("all-fields-are-messages", false, "try really hard to disassemble all fields as messages")
3534
)
3635

@@ -80,7 +79,7 @@ func main() {
8079
}
8180
} else {
8281
outBytes = []byte(protoscope.Write(inBytes, protoscope.WriterOptions{
83-
NoQuotedStrings: *noQuotedStrings,
82+
NoQuotedStrings: *noQuotedStrings,
8483
AllFieldsAreMessages: *allFieldsAreMessages,
8584
}))
8685
}
@@ -95,7 +94,7 @@ func main() {
9594
}
9695
defer outFile.Close()
9796
}
98-
97+
9998
if _, err = outFile.Write(outBytes); err != nil {
10099
fmt.Fprintf(os.Stderr, "Error writing output: %s\n", err)
101100
os.Exit(1)

roundtrip_fuzz_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ func FuzzRoundTrip(f *testing.F) {
3131
t.Fatalf("%x: not equal after tound trip: %x", in, out)
3232
}
3333
})
34-
}
34+
}

writer.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func Write(src []byte, opts WriterOptions) string {
6969

7070
type line struct {
7171
text, comment *strings.Builder
72-
indent int
72+
indent int
7373
}
7474

7575
type writer struct {
@@ -79,22 +79,22 @@ type writer struct {
7979
}
8080

8181
func (w *writer) write(args ...any) {
82-
fmt.Fprint(w.lines[len(w.lines) - 1].text, args...)
82+
fmt.Fprint(w.lines[len(w.lines)-1].text, args...)
8383
}
8484

8585
func (w *writer) writef(f string, args ...any) {
86-
fmt.Fprintf(w.lines[len(w.lines) - 1].text, f, args...)
86+
fmt.Fprintf(w.lines[len(w.lines)-1].text, f, args...)
8787
}
8888

8989
func (w *writer) commentf(f string, args ...any) {
90-
fmt.Fprintf(w.lines[len(w.lines) - 1].comment, f, args...)
90+
fmt.Fprintf(w.lines[len(w.lines)-1].comment, f, args...)
9191
}
9292

9393
func (w *writer) newLine() {
94-
w.lines = append(w.lines, line {
95-
text: new(strings.Builder),
94+
w.lines = append(w.lines, line{
95+
text: new(strings.Builder),
9696
comment: new(strings.Builder),
97-
indent: w.indent,
97+
indent: w.indent,
9898
})
9999
}
100100

@@ -230,7 +230,7 @@ func (w *writer) decodeField(src []byte) ([]byte, bool) {
230230
}
231231

232232
if len(src2) == 0 || (w.opts.AllFieldsAreMessages && len(src2) < len(delimited)) {
233-
oneLiner := len(w.lines) == startLine + 1 && len(src2) == 0
233+
oneLiner := len(w.lines) == startLine+1 && len(src2) == 0
234234
if oneLiner {
235235
line := w.lines[startLine]
236236
w.lines = w.lines[:startLine]

writer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
package protoscope
1616

1717
import (
18+
"embed"
1819
"strings"
1920
"testing"
20-
"embed"
2121

2222
"github.com/google/go-cmp/cmp"
2323
)

0 commit comments

Comments
 (0)