Skip to content

Commit 7444b7a

Browse files
Always end template files in a newline (#3687)
* End all grpc templates in newlines - Remove spurious newline in parse_endpoint - Update test (leave trailing whitespace alone) * End all http templates in newlines - request_init.go.tpl needs to strip it - Most partials need to strip, but handle once inside templates.go * End all services and example templates in newlines - codegen/service/templates/return_type_init.go.tpl removes this with a trailing dash, as the say it's consumed through validations is hard to follow and fix - example now spaces out before var(){} blocks including after flag.Parse() --------- Co-authored-by: Raphael Simon <simon.raphael@gmail.com>
1 parent 18d5007 commit 7444b7a

52 files changed

Lines changed: 58 additions & 48 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

codegen/example/templates/client_end.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
m, _ := json.MarshalIndent(data, "", " ")
1111
fmt.Println(string(m))
1212
}
13-
}
13+
}

codegen/example/templates/client_endpoint_init.go.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
var(
2+
var(
33
endpoint goa.Endpoint
44
payload any
55
err error
@@ -22,4 +22,4 @@ var(
2222
fmt.Fprintln(os.Stderr, err.Error())
2323
fmt.Fprintln(os.Stderr, "run '"+os.Args[0]+" --help' for detailed usage.")
2424
os.Exit(1)
25-
}
25+
}

codegen/example/templates/client_start.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ func main() {
1111
timeoutF = flag.Int("timeout", 30, "Maximum number of seconds to wait for response")
1212
)
1313
flag.Usage = usage
14-
flag.Parse()
14+
flag.Parse()

codegen/example/templates/client_var_init.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ var (
5151
}
5252
scheme = u.Scheme
5353
host = u.Host
54-
}
54+
}

codegen/example/templates/server_end.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88

99
wg.Wait()
1010
log.Printf(ctx, "exited")
11-
}
11+
}

codegen/example/templates/server_endpoints.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@
1717
{{- end }}
1818
{{- end }}
1919
}
20-
{{- end }}
20+
{{- end }}

codegen/example/templates/server_handler.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@
5151
{{- end }}
5252
default:
5353
log.Fatal(ctx, fmt.Errorf("invalid host argument: %q (valid hosts: {{ join .Server.AvailableHosts "|" }})", *hostF))
54-
}
54+
}

codegen/example/templates/server_interceptors.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
{{- end }}
1717
}
1818
{{- end }}
19-
{{- end }}
19+
{{- end }}

codegen/example/templates/server_interrupts.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
}()
1414

1515
var wg sync.WaitGroup
16-
ctx, cancel := context.WithCancel(ctx)
16+
ctx, cancel := context.WithCancel(ctx)

codegen/example/templates/server_logger.go.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
ctx = log.Context(ctx, log.WithDebug())
1111
log.Debugf(ctx, "debug logs enabled")
1212
}
13-
log.Print(ctx, log.KV{K: "http-port", V: *httpPortF})
13+
log.Print(ctx, log.KV{K: "http-port", V: *httpPortF})

0 commit comments

Comments
 (0)