github.com/segakazzz/buffalo@v0.16.22-0.20210119082501-1f52048d3feb/genny/build/build_deps.go (about)

     1  package build
     2  
     3  import (
     4  	"os/exec"
     5  
     6  	"github.com/gobuffalo/envy"
     7  	"github.com/gobuffalo/genny/v2"
     8  )
     9  
    10  func buildDeps(opts *Options) (*genny.Generator, error) {
    11  	g := genny.New()
    12  
    13  	if err := opts.Validate(); err != nil {
    14  		return g, err
    15  	}
    16  
    17  	if envy.Mods() {
    18  		return g, nil
    19  	}
    20  
    21  	// mount the go get runner
    22  	tf := opts.App.BuildTags(opts.Environment, opts.Tags...)
    23  	if len(tf) > 0 {
    24  		tf = append([]string{"-tags"}, tf.String())
    25  	}
    26  	args := []string{"get"}
    27  	args = append(args, tf...)
    28  	args = append(args, "./...")
    29  	g.Command(exec.Command("go", args...))
    30  	return g, nil
    31  }