Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: logdog/client/cmd/logdog_butler/subcommand_stream.go

Issue 2179963003: LogDog/Butler: Prefer overridden stream name. (Closed) Base URL: https://github.com/luci/luci-go@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/cmd/logdog_butler/subcommand_stream.go
diff --git a/logdog/client/cmd/logdog_butler/subcommand_stream.go b/logdog/client/cmd/logdog_butler/subcommand_stream.go
index 3982285c57b1b28e1074053e718f085591bc52a9..85efca71a747a80d929e93ab280fbabba42abf10 100644
--- a/logdog/client/cmd/logdog_butler/subcommand_stream.go
+++ b/logdog/client/cmd/logdog_butler/subcommand_stream.go
@@ -46,9 +46,12 @@ type streamCommandRun struct {
func (cmd *streamCommandRun) Run(app subcommands.Application, args []string) int {
a := app.(*application)
- streamFile := (*os.File)(nil)
+ var (
+ streamFile *os.File
+ defaultStreamName streamproto.StreamNameFlag
+ )
if cmd.path == "-" {
- cmd.stream.Name = "stdin"
+ defaultStreamName = "stdin"
streamFile = os.Stdin
} else {
streamName, err := types.MakeStreamName("file:", cmd.path)
@@ -58,7 +61,7 @@ func (cmd *streamCommandRun) Run(app subcommands.Application, args []string) int
}.Errorf(a, "Failed to generate stream name.")
return runtimeErrorReturnCode
}
- cmd.stream.Name = streamproto.StreamNameFlag(streamName)
+ defaultStreamName = streamproto.StreamNameFlag(streamName)
file, err := os.Open(cmd.path)
if err != nil {
@@ -70,6 +73,9 @@ func (cmd *streamCommandRun) Run(app subcommands.Application, args []string) int
}
streamFile = file
}
+ if cmd.stream.Name == "" {
+ cmd.stream.Name = defaultStreamName
+ }
// We think everything should work. Configure our Output instance.
output, err := a.configOutput()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698