Skip to content
This repository has been archived by the owner on Nov 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #22 from sho-hata/feat/updateGoVersion
Browse files Browse the repository at this point in the history
Feat/update go version
  • Loading branch information
sho-hata authored Jun 18, 2022
2 parents 65b5546 + 788a518 commit f598ffe
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: 1.17
go-version: 1.18
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
Expand Down
10 changes: 1 addition & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,11 @@ jobs:
- name: set up
uses: actions/setup-go@v3
with:
go-version: ^1.17
go-version: ^1.18
id: go
- name: check out
uses: actions/checkout@v3

- name: Cache
uses: actions/cache@v2.1.0
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
build:
needs: setup
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ before:
builds:
- main: .
binary: hasuraf
ldflags: -s -w
archives:
- replacements:
darwin: darwin
Expand Down
52 changes: 18 additions & 34 deletions cmd/hasura/hasura_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ func TestCmd_setCommand(t *testing.T) {
target string
}

tests := []struct {
name string
tests := map[string]struct {
fields fields
want *HasuraCmd
}{
{
name: "case: not set h.target",
"case: not set h.target": {
fields: fields{
called: "seed apply",
},
Expand All @@ -32,8 +30,7 @@ func TestCmd_setCommand(t *testing.T) {
command: []string{"seed", "apply"},
},
},
{
name: "case: h.called == 'seed apply'",
"case: h.called == 'seed apply'": {
fields: fields{
called: "seed apply",
target: "xxx.sql",
Expand All @@ -44,8 +41,7 @@ func TestCmd_setCommand(t *testing.T) {
command: []string{"seed", "apply", "--file", "xxx.sql"},
},
},
{
name: "case: h.called == 'seed apply', set string options",
"case: h.called == 'seed apply', set string options": {
fields: fields{
called: "seed apply",
target: "xxx.sql",
Expand All @@ -62,8 +58,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'seed apply', set bool options",
"case: h.called == 'seed apply', set bool options": {
fields: fields{
called: "seed apply",
target: "xxx.sql",
Expand All @@ -80,8 +75,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'seed apply', set bool and string options",
"case: h.called == 'seed apply', set bool and string options": {
fields: fields{
called: "seed apply",
target: "xxx.sql",
Expand All @@ -100,8 +94,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called != 'seed apply'",
"case: h.called != 'seed apply'": {
fields: fields{
called: "migrate",
target: "xxx.sql",
Expand All @@ -111,8 +104,7 @@ func TestCmd_setCommand(t *testing.T) {
applyTarget: "xxx.sql",
},
},
{
name: "case: h.called == 'migrate apply'",
"case: h.called == 'migrate apply'": {
fields: fields{
called: "migrate apply",
target: "xxx",
Expand All @@ -123,8 +115,7 @@ func TestCmd_setCommand(t *testing.T) {
command: []string{"migrate", "apply", "--version", "xxx"},
},
},
{
name: "case: h.called == 'migrate apply', set string options",
"case: h.called == 'migrate apply', set string options": {
fields: fields{
called: "migrate apply",
target: "xxx",
Expand All @@ -141,8 +132,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'migrate apply', set bool options",
"case: h.called == 'migrate apply', set bool options": {
fields: fields{
called: "migrate apply",
target: "xxx",
Expand All @@ -159,8 +149,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'migrate', set bool and string options",
"case: h.called == 'migrate', set bool and string options": {
fields: fields{
called: "migrate apply",
target: "xxx",
Expand All @@ -179,8 +168,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'migrate delete'",
"case: h.called == 'migrate delete'": {
fields: fields{
called: "migrate delete",
target: "xxx",
Expand All @@ -191,8 +179,7 @@ func TestCmd_setCommand(t *testing.T) {
command: []string{"migrate", "delete", "--version", "xxx"},
},
},
{
name: "case: h.called == 'migrate delete', set string options",
"case: h.called == 'migrate delete', set string options": {
fields: fields{
called: "migrate delete",
target: "xxx",
Expand All @@ -209,8 +196,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'migrate delete', set bool options",
"case: h.called == 'migrate delete', set bool options": {
fields: fields{
called: "migrate delete",
target: "xxx",
Expand All @@ -227,8 +213,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called == 'migrate', set bool and string options",
"case: h.called == 'migrate delete', set bool and string options": {
fields: fields{
called: "migrate delete",
target: "xxx",
Expand All @@ -247,8 +232,7 @@ func TestCmd_setCommand(t *testing.T) {
},
},
},
{
name: "case: h.called != 'seed apply' & h.called != 'migrate apply & h.called != 'migrate delete'",
"case: h.called != 'seed apply' & h.called != 'migrate apply & h.called != 'migrate delete'": {
fields: fields{
called: "hoge",
target: "xxx",
Expand All @@ -259,9 +243,9 @@ func TestCmd_setCommand(t *testing.T) {
},
},
}
for _, tt := range tests {
for testCase, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Run(testCase, func(t *testing.T) {
t.Parallel()
h := &HasuraCmd{
called: tt.fields.called,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/sho-hata/hasuraf

go 1.17
go 1.18

require (
github.com/ktr0731/go-fuzzyfinder v0.5.1
Expand Down

0 comments on commit f598ffe

Please # to comment.