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

Commit

Permalink
More reliable fix for Go 1.16 build issues (#2119)
Browse files Browse the repository at this point in the history
* Call "go get -d" when building the a package.

* Fix failing tests
  • Loading branch information
fasmat authored Jul 6, 2021
1 parent c6b505f commit c149314
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 7 additions & 0 deletions genny/build/apkg.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package build

import (
"os/exec"

"github.com/gobuffalo/genny/v2"
)

Expand All @@ -13,10 +15,15 @@ func apkg(opts *Options) (*genny.Generator, error) {

g.RunFn(copyInflections)
g.RunFn(copyDatabase)
g.RunFn(addDependencies)

return g, nil
}

func addDependencies(r *genny.Runner) error {
return r.Exec(exec.Command("go", "get", "-d"))
}

func copyDatabase(r *genny.Runner) error {
defer func() {
r.Disk.Remove("database.yml")
Expand Down
8 changes: 0 additions & 8 deletions genny/build/build-packr.go

This file was deleted.

4 changes: 2 additions & 2 deletions genny/build/build_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func Test_New(t *testing.T) {
// we should never leave any files modified or dropped
r.Len(res.Files, 0)

cmds := []string{"go build -tags bar -o bin/foo", "go mod tidy"}
cmds := []string{"go get -d", "go build -tags bar -o bin/foo", "go mod tidy"}
r.Len(res.Commands, len(cmds))
for i, c := range res.Commands {
eq(r, cmds[i], c)
Expand Down Expand Up @@ -84,7 +84,7 @@ func Test_NewWithoutBuildDeps(t *testing.T) {

res := run.Results()

cmds := []string{"go build -tags bar -o bin/foo"}
cmds := []string{"go get -d", "go build -tags bar -o bin/foo"}
r.Len(res.Commands, len(cmds))
for i, c := range res.Commands {
eq(r, cmds[i], c)
Expand Down

0 comments on commit c149314

Please sign in to comment.