chore: fmt

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2026-06-06 10:03:56 -03:00
parent 5c2f7caebf
commit 3f96cfd981
9 changed files with 84 additions and 74 deletions
+2 -1
View File
@@ -91,7 +91,8 @@ func TestUpgrade(t *testing.T) {
target := fmt.Sprintf("./testdata/acceptance/%s", oldpkg)
require.NoError(t, os.MkdirAll("./testdata/acceptance/tmp", 0o700))
config, err := nfpm.ParseFileWithEnvMapping(fmt.Sprintf("./testdata/acceptance/%s.v1.yaml", testName),
config, err := nfpm.ParseFileWithEnvMapping(
fmt.Sprintf("./testdata/acceptance/%s.v1.yaml", testName),
func(s string) string {
switch s {
case "BUILD_ARCH":
+2 -1
View File
@@ -134,7 +134,8 @@ func TestArchConventionalFileName(t *testing.T) {
info := exampleInfo()
info.Arch = arch
name := Default.ConventionalFileName(info)
require.Equal(t,
require.Equal(
t,
"foo-test-1.0.0beta_1-1-"+archToArchLinux[arch]+".pkg.tar.zst",
name,
)
+2 -1
View File
@@ -877,7 +877,8 @@ func tarHeader(content *files.Content, preferredModTimes ...time.Time) (*tar.Hea
h := &tar.Header{
Name: content.Name(),
ModTime: modtime.Get(
append(preferredModTimes, content.ModTime())...),
append(preferredModTimes, content.ModTime())...,
),
Mode: int64(fm & 0o7777),
Uname: content.FileInfo.Owner,
Gname: content.FileInfo.Group,
+2 -1
View File
@@ -553,7 +553,8 @@ func contentCollisionError(newc *Content, present *Content) error {
presentSource = " with source " + present.Source
}
return fmt.Errorf("adding %s at destination %s: "+
return fmt.Errorf(
"adding %s at destination %s: "+
"%s%s is already present at this destination: %w",
newc.Type, newc.Destination, present.Type, presentSource, ErrContentCollision,
)
+2 -1
View File
@@ -43,7 +43,8 @@ func newPackageCmd() *packageCmd {
cmd.Flags().StringVarP(&root.packager, "packager", "p", "",
fmt.Sprintf("which packager implementation to use [%s]", strings.Join(pkgs, "|")))
_ = cmd.RegisterFlagCompletionFunc("packager", cobra.FixedCompletions(pkgs,
_ = cmd.RegisterFlagCompletionFunc("packager", cobra.FixedCompletions(
pkgs,
cobra.ShellCompDirectiveNoFileComp,
))
+10 -5
View File
@@ -127,7 +127,8 @@ func (d *IPK) Package(info *nfpm.Info, ipk io.Writer) error {
// Strip out any custom fields that are disallowed.
stripDisallowedFields(info)
contents, err := newTGZ("ipk",
contents, err := newTGZ(
"ipk",
func(tw *tar.Writer) error {
return createIPK(info, tw)
},
@@ -145,7 +146,8 @@ func (d *IPK) Package(info *nfpm.Info, ipk io.Writer) error {
func createIPK(info *nfpm.Info, ipk *tar.Writer) error {
var installSize int64
data, err := newTGZ("data.tar.gz",
data, err := newTGZ(
"data.tar.gz",
func(tw *tar.Writer) error {
var err error
installSize, err = populateDataTar(info, tw)
@@ -156,7 +158,8 @@ func createIPK(info *nfpm.Info, ipk *tar.Writer) error {
return err
}
control, err := newTGZ("control.tar.gz",
control, err := newTGZ(
"control.tar.gz",
func(tw *tar.Writer) error {
return populateControlTar(info, tw, installSize)
},
@@ -199,7 +202,8 @@ func populateDataTar(info *nfpm.Info, tw *tar.Writer) (instSize int64, err error
Mode: int64(file.FileInfo.Mode),
Uname: file.FileInfo.Owner,
Gname: file.FileInfo.Group,
})
},
)
case files.TypeSymlink:
err = tw.WriteHeader(
&tar.Header{
@@ -208,7 +212,8 @@ func populateDataTar(info *nfpm.Info, tw *tar.Writer) (instSize int64, err error
Format: tar.FormatGNU,
ModTime: modtime.Get(info.MTime),
Linkname: file.Source,
})
},
)
case files.TypeFile, files.TypeTree, files.TypeConfig, files.TypeConfigNoReplace, files.TypeConfigMissingOK:
size, err = writeFile(tw, file)
default: