Skip to content

Commit

Permalink
fix: address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornplusplus committed Aug 6, 2024
1 parent e8639dd commit b85eb2a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion cmd/chisel/cmd_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,5 @@ func selectPackageSlices(release *setup.Release, queries []string) (packages []*
}
packages = append(packages, pkg)
}
return
return packages, notFound
}
8 changes: 4 additions & 4 deletions cmd/chisel/cmd_info_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ var infoTests = []infoTest{{
- mypkg2_myslice
`,
}, {
summary: "All kinds of path",
summary: "All kinds of paths",
input: infoRelease,
query: []string{"mypkg3"},
stdout: `
Expand Down Expand Up @@ -172,6 +172,7 @@ var infoTests = []infoTest{{
}}

var testKey = testutil.PGPKeys["key1"]

var defaultChiselYaml = `
format: chisel-v1
archives:
Expand All @@ -182,8 +183,7 @@ var defaultChiselYaml = `
v1-public-keys:
test-key:
id: ` + testKey.ID + `
armor: |` + "\n" + testutil.PrefixEachLine(testKey.PubKeyArmor, "\t\t\t\t\t\t") + `
`
armor: |` + "\n" + testutil.PrefixEachLine(testKey.PubKeyArmor, "\t\t\t\t\t\t")

var infoRelease = map[string]string{
"chisel.yaml": string(defaultChiselYaml),
Expand Down Expand Up @@ -255,6 +255,6 @@ func (s *ChiselSuite) TestInfoCommand(c *C) {
}
c.Assert(err, IsNil)
test.stdout = string(testutil.Reindent(test.stdout))
c.Assert(strings.TrimSpace(s.Stdout()), Equals, strings.TrimSpace(test.stdout))
c.Assert(s.Stdout(), Equals, strings.TrimSpace(test.stdout)+"\n")
}
}
21 changes: 12 additions & 9 deletions internal/setup/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,15 +357,14 @@ type yamlPackage struct {
}

type yamlPath struct {
Dir bool `yaml:"make,omitempty"`
Copy string `yaml:"copy,omitempty"`
Text *string `yaml:"text,omitempty"`
Symlink string `yaml:"symlink,omitempty"`
Mutable bool `yaml:"mutable,omitempty"`

Until PathUntil `yaml:"until,omitempty"`
Arch yamlArch `yaml:"arch,omitempty"`
Mode yamlMode `yaml:"mode,omitempty"`
Dir bool `yaml:"make,omitempty"`
Copy string `yaml:"copy,omitempty"`
Text *string `yaml:"text,omitempty"`
Symlink string `yaml:"symlink,omitempty"`
Mutable bool `yaml:"mutable,omitempty"`
Until PathUntil `yaml:"until,omitempty"`
Arch yamlArch `yaml:"arch,omitempty"`
Mode yamlMode `yaml:"mode,omitempty"`
}

func (yp *yamlPath) MarshalYAML() (interface{}, error) {
Expand Down Expand Up @@ -419,6 +418,8 @@ func (ya yamlArch) MarshalYAML() (interface{}, error) {
return ya.List, nil
}

var _ yaml.Marshaler = yamlArch{}

type yamlMode uint

func (ym yamlMode) MarshalYAML() (interface{}, error) {
Expand All @@ -433,6 +434,8 @@ func (ym yamlMode) MarshalYAML() (interface{}, error) {
return node, nil
}

var _ yaml.Marshaler = yamlMode(0)

type yamlSlice struct {
Essential []string `yaml:"essential,omitempty"`
Contents map[string]*yamlPath `yaml:"contents,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion tests/info/task.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
summary: Chisel can show detailed info about slices
summary: Chisel can show detailed information about slices

execute: |
# Install dependencies.
Expand Down

0 comments on commit b85eb2a

Please sign in to comment.