Skip to content

Commit

Permalink
style: Cleanups to #361 - use more idiomatic Go (#364)
Browse files Browse the repository at this point in the history
Chad gave me a few style suggestions after I merged #361--this applies
those style suggestions.
  • Loading branch information
josh-berry authored Oct 20, 2023
1 parent 4d2784a commit 0d0a8a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion common/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func readJSONInputs(c *cli.Context) ([][]byte, error) {
} else if c.IsSet(FlagInputFile) {
inputFiles := c.StringSlice(FlagInputFile)

args := [][]byte{}
args := make([][]byte, 0, len(inputFiles))
for _, inputFile := range inputFiles {
// This method is purely used to parse input from the CLI. The input
// comes from a trusted user #nosec
Expand Down
14 changes: 7 additions & 7 deletions tests/workflow_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func (s *e2eSuite) TestWorkflowExecute_Input() {
// don't have a way to check the CLI output directly to make sure it prints
// the right result...)
err := cli.Run([]string{"", "workflow", "execute",
"--input", "1", "--input", "\"two\"", "--input", "{\"three\": 3}",
"--input", "[\"a\", \"b\", \"c\"]",
"--input", `1`, "--input", `"two"`, "--input", `{"three": 3}`,
"--input", `["a", "b", "c"]`,
"--type", "Workflow", "--task-queue", testTq, "--workflow-id", "test"})
s.NoError(err)

Expand All @@ -54,7 +54,7 @@ func (s *e2eSuite) TestWorkflowExecute_Input() {
err = wf.Get(context.Background(), &result)
s.NoError(err)

s.Assert().Equal("[1,\"two\",{\"three\":3},[\"a\",\"b\",\"c\"]]", result)
s.Assert().Equal(`[1,"two",{"three":3},["a","b","c"]]`, result)
}

func (s *e2eSuite) TestWorkflowExecute_InputFile() {
Expand All @@ -66,9 +66,9 @@ func (s *e2eSuite) TestWorkflowExecute_InputFile() {
filepath.Join(tempDir, "arg3.json"), filepath.Join(tempDir, "arg4.json"),
}
s.NoError(os.WriteFile(argFiles[0], []byte("1"), 0700))
s.NoError(os.WriteFile(argFiles[1], []byte("\"two\""), 0700))
s.NoError(os.WriteFile(argFiles[2], []byte("{\"three\": 3}"), 0700))
s.NoError(os.WriteFile(argFiles[3], []byte("[\"a\", \"b\", \"c\"]"), 0700))
s.NoError(os.WriteFile(argFiles[1], []byte(`"two"`), 0700))
s.NoError(os.WriteFile(argFiles[2], []byte(`{"three": 3}`), 0700))
s.NoError(os.WriteFile(argFiles[3], []byte(`["a", "b", "c"]`), 0700))

server, cli, _ := s.setUpTestEnvironment()
defer func() { _ = server.Stop() }()
Expand Down Expand Up @@ -96,7 +96,7 @@ func (s *e2eSuite) TestWorkflowExecute_InputFile() {
err = wf.Get(context.Background(), &result)
s.NoError(err)

s.Assert().Equal("[1,\"two\",{\"three\":3},[\"a\",\"b\",\"c\"]]", result)
s.Assert().Equal(`[1,"two",{"three":3},["a","b","c"]]`, result)
}

func (s *e2eSuite) TestWorkflowShow_ReplayableHistory() {
Expand Down

0 comments on commit 0d0a8a6

Please sign in to comment.