Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update github workflows #70

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/go-presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ['1.17', '1.18', '1.19']
go-version: ['1.19', '1.20', '1.21']
steps:
- name: Install Go ${{ matrix.go-version }}
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v3
- uses: creachadair/go-presubmit-action@v1
- uses: actions/checkout@v4
- uses: creachadair/go-presubmit-action@v2
with:
staticcheck-version: "2022.1.3"
staticcheck-version: "2023.1.6"
16 changes: 7 additions & 9 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: 1.21

- name: Run GoReleaser release (SKIP publish)
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/') != true
with:
distribution: goreleaser
version: latest
args: release --rm-dist --skip-publish
args: release --clean --skip=publish --snapshot
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run GoReleaser release
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v5
if: startsWith(github.ref, 'refs/tags/')
with:
distribution: goreleaser
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10 changes: 9 additions & 1 deletion gauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ func addCode(accountName string) {
// Check for encryption and ask for password if necessary
_, isEncrypted, err := gauth.ReadConfigFile(cfgPath)

if err != nil {
log.Fatalf("Reading config: %v", err)
}

password, err := []byte(nil), nil

if isEncrypted {
Expand Down Expand Up @@ -169,13 +173,17 @@ func removeCode(accountName string) {
// Check for encryption and ask for password if necessary
_, isEncrypted, err := gauth.ReadConfigFile(cfgPath)

if err != nil {
log.Fatalf("Reading config: %v", err)
}

password, err := []byte(nil), nil

if isEncrypted {
password, err = getPassword()

if err != nil {
log.Fatalf("reading passphrase: %v", err)
log.Fatalf("Reading passphrase: %v", err)
}
}

Expand Down
6 changes: 3 additions & 3 deletions gauth/gauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"errors"
"fmt"
"hash"
"io/ioutil"
"os"
"strings"
"time"

Expand Down Expand Up @@ -78,7 +78,7 @@ func CodesAtTimeStep(u *otpauth.URL, timeStep uint64) (prev, curr, next string,
// ReadConfigFile reads the config file at path and returns its contents and
// whether it is encrypted or not
func ReadConfigFile(path string) ([]byte, bool, error) {
data, err := ioutil.ReadFile(path)
data, err := os.ReadFile(path)
if err != nil {
return nil, false, err
}
Expand Down Expand Up @@ -184,7 +184,7 @@ func WriteConfigFile(path string, passwd []byte, newConfig []byte) error {
newConfig = append(saltedPrefix, newConfig...)
}

err = ioutil.WriteFile(path, newConfig, 0)
err = os.WriteFile(path, newConfig, 0)

if err != nil {
return fmt.Errorf("writing config: %v", err)
Expand Down
Loading