Skip to content

Commit 2ff0299

Browse files
authored
Merge pull request #147 from simpsora/keyring_debugging
2 parents 4752e85 + 314aa8f commit 2ff0299

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

cmd/add.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ var addCmd = &cobra.Command{
6262
PreRun: func(cmd *cobra.Command, args []string) {
6363
if verbose {
6464
log.SetLevel(log.DebugLevel)
65+
keyring.Debug = true
6566
}
6667
},
6768
Run: func(cmd *cobra.Command, args []string) {
@@ -169,14 +170,22 @@ var addCmd = &cobra.Command{
169170
log.Fatal(err)
170171
}
171172

172-
ring, _ := keyring.Open(keyringDefaults)
173+
ring, err := keyring.Open(keyringDefaults)
174+
if err != nil {
175+
log.Fatalf("failed to open keyring backend: %s", strings.ToLower(err.Error()))
176+
}
173177

174-
_ = ring.Set(keyring.Item{
178+
resp := ring.Set(keyring.Item{
175179
Key: fmt.Sprintf("%s-%s", profileName, authType),
176180
Data: []byte(authValue),
177181
})
178182

179-
fmt.Println("\nSuccess! Credentials have been set and are now ready for use!")
183+
if resp == nil {
184+
fmt.Println("\nSuccess! Credentials have been set and are now ready for use!")
185+
} else {
186+
// error of some sort
187+
log.Fatal("Error adding credentials to keyring: ", resp)
188+
}
180189
},
181190
}
182191

cmd/exec.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ var execCmd = &cobra.Command{
5454
PreRun: func(cmd *cobra.Command, args []string) {
5555
if verbose {
5656
log.SetLevel(log.DebugLevel)
57+
keyring.Debug = true
5758
}
5859
},
5960
Run: func(cmd *cobra.Command, args []string) {

script/build

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ -d build ]; then
1515
fi
1616
mkdir -p build
1717

18-
platforms=("windows/amd64" "linux/amd64" "darwin/amd64")
18+
platforms=("windows/amd64" "linux/amd64" "darwin/amd64" "darwin/arm64")
1919

2020
echo "==> Build started for v${version}"
2121

@@ -35,9 +35,9 @@ do
3535
GCFLAGS="-gcflags=all=-trimpath=$GOPATH -asmflags=all=-trimpath=$GOPATH"
3636

3737
if [ $GOOS = "windows" ]; then
38-
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
38+
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/${GOARCH}/cf-vault.exe" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
3939
else
40-
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
40+
env GOOS=$GOOS GOARCH=$GOARCH go build $GCFLAGS -o "build/${GOOS}/${GOARCH}/cf-vault" -ldflags "-X github.com/jacobbednarz/cf-vault/cmd.Rev=${version_with_sha}" .
4141
fi
4242
if [ $? -ne 0 ]; then
4343
echo "Building the binary has failed!"
@@ -48,9 +48,9 @@ do
4848

4949
printf "==> Tarballing %s\t%s\n" "$platform" "build/${output_name}.tar.gz" | expand -t 30
5050
if [ $GOOS = "windows" ]; then
51-
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS" "cf-vault.exe"
51+
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS/$GOARCH" "cf-vault.exe"
5252
else
53-
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS" "cf-vault"
53+
tar -czf "build/${output_name}.tar.gz" -C "build/$GOOS/$GOARCH" "cf-vault"
5454
fi
5555

5656
if [ $? -ne 0 ]; then
@@ -59,7 +59,7 @@ do
5959
fi
6060

6161
echo "==> Adding file checksums to build/checksums.txt"
62-
shasum -a 256 build/$GOOS/* >> "build/checksums.txt"
62+
shasum -a 256 build/$GOOS/$GOARCH/* >> "build/checksums.txt"
6363
done
6464

6565
shasum -a 256 build/*.tar.gz >> "build/checksums.txt"

0 commit comments

Comments
 (0)