Skip to content

Commit

Permalink
github: Fix build setup
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Jun 4, 2023
1 parent b163f5a commit 17b98ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
15 changes: 1 addition & 14 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go-version }}
- name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest
shell: bash
- name: Install golint
run: go install golang.org/x/lint/golint@latest
shell: bash
Expand All @@ -26,15 +23,5 @@ jobs:
shell: bash
- name: Checkout code
uses: actions/checkout@v1
- name: Fmt
if: matrix.platform != 'windows-latest' # :(
run: "diff <(gofmt -d .) <(printf '')"
shell: bash
- name: Vet
run: go vet ./...
- name: Staticcheck
run: staticcheck ./...
- name: Lint
run: golint ./...
- name: Test
run: go test -race ./...
run: go test -race .
6 changes: 6 additions & 0 deletions mclib.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ var errorReplacer = strings.NewReplacer(
"ERROR: ", "",
)

// RunMain runs mkcert's main function.
//
// You need to set os.Args before calling this function, e.g.
//
// os.Args = []string{"-install"}
// os.Args = []string{"-cert-file", "cert.pem", "-key-file", "key.pem", "example.com"}
func RunMain() (err error) {
defer func() {
if r := recover(); r != nil {
Expand Down
10 changes: 3 additions & 7 deletions mclib_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,14 @@ import (
qt "github.com/frankban/quicktest"
)

func TestRunMainOK(t *testing.T) {
func TestRunMain(t *testing.T) {
c := qt.New(t)
os.Args = []string{"-help"}
c.Assert(mclib.RunMain(), qt.IsNil)

}

func TestRunMainError(t *testing.T) {
func TestGetCAROOT(t *testing.T) {
c := qt.New(t)
os.Args = []string{"-install", "-CAROOT", "asdfasdfasdfasdf"}
err := mclib.RunMain()
c.Assert(err, qt.IsNotNil)
c.Assert(err.Error(), qt.Equals, "you can't set -[un]install and -CAROOT at the same time")

c.Assert(mclib.GetCAROOT(), qt.Not(qt.Equals), "")
}

0 comments on commit 17b98ce

Please sign in to comment.