Skip to content

Commit 26b0754

Browse files
committed
refactor(release): unwrap useless SigningStuff struct
Replace SigningStuff with just the string it contains.
1 parent 0c648d5 commit 26b0754

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

dist/sign-release.go

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,12 @@ import "time"
2525
// Path to the 'dist' directory containing this file (sign-release.go).
2626
var DistPath string
2727

28-
type SigningStuff struct {
29-
RelicConfigPath string
30-
}
28+
var RelicConfigPath string
3129

3230
// Key: SHA256 hash of original file
3331
// Value: contents of transformed (signed) file
3432
var TransformCache map[SHA256Hash]FileTransformResult = make(map[SHA256Hash]FileTransformResult)
3533

36-
var signingStuff SigningStuff
37-
3834
var ProgramStartTime time.Time = time.Now()
3935
var TempDirs []string
4036

@@ -43,14 +39,14 @@ func main() {
4339

4440
defer RemoveTempDirs()
4541

46-
flag.StringVar(&signingStuff.RelicConfigPath, "RelicConfig", "", "")
42+
flag.StringVar(&RelicConfigPath, "RelicConfig", "", "")
4743
flag.Parse()
4844
if flag.NArg() != 2 {
4945
os.Stderr.WriteString(fmt.Sprintf("error: source and destination directories\n"))
5046
os.Exit(2)
5147
}
5248

53-
signingStuff.RelicConfigPath, err = filepath.Abs(signingStuff.RelicConfigPath)
49+
RelicConfigPath, err = filepath.Abs(RelicConfigPath)
5450
if err != nil {
5551
log.Fatal(err)
5652
}
@@ -776,7 +772,7 @@ func RelicFile(inFilePath string, outFilePath string, signingType RelicSigningTy
776772

777773
signCommand := []string{
778774
"relic", "sign",
779-
"--config", signingStuff.RelicConfigPath,
775+
"--config", RelicConfigPath,
780776
"--file", inFileAbsolutePath,
781777
"--output", outFileAbsolutePath,
782778
}
@@ -796,7 +792,7 @@ func RelicFile(inFilePath string, outFilePath string, signingType RelicSigningTy
796792
process := exec.Command(signCommand[0], signCommand[1:]...)
797793
process.Stdout = os.Stdout
798794
process.Stderr = os.Stderr
799-
process.Dir = filepath.Dir(signingStuff.RelicConfigPath)
795+
process.Dir = filepath.Dir(RelicConfigPath)
800796
if err := process.Start(); err != nil {
801797
return err
802798
}

0 commit comments

Comments
 (0)