github.com/goreleaser/goreleaser@v1.25.1/internal/pipe/partial/partial.go (about)

     1  package partial
     2  
     3  import (
     4  	"os"
     5  	"runtime"
     6  
     7  	"github.com/charmbracelet/x/exp/ordered"
     8  	"github.com/goreleaser/goreleaser/pkg/context"
     9  )
    10  
    11  type Pipe struct{}
    12  
    13  func (Pipe) String() string                 { return "partial" }
    14  func (Pipe) Skip(ctx *context.Context) bool { return !ctx.Partial }
    15  
    16  func (Pipe) Run(ctx *context.Context) error {
    17  	ctx.PartialTarget = getFilter()
    18  	return nil
    19  }
    20  
    21  func getFilter() string {
    22  	goos := ordered.First(os.Getenv("GGOOS"), os.Getenv("GOOS"), runtime.GOOS)
    23  	goarch := ordered.First(os.Getenv("GGOARCH"), os.Getenv("GOARCH"), runtime.GOARCH)
    24  	return goos + "_" + goarch
    25  }