github.com/tomsquest/goreleaser@v0.34.3-0.20171008022654-7d6ef4d338b3/internal/archiveformat/format.go (about)

     1  // Package archiveformat provides functions to get the format of given package
     2  // based on the config
     3  package archiveformat
     4  
     5  import (
     6  	"strings"
     7  
     8  	"github.com/goreleaser/goreleaser/context"
     9  )
    10  
    11  // For return the archive format, considering overrides and all that
    12  func For(ctx *context.Context, platform string) string {
    13  	for _, override := range ctx.Config.Archive.FormatOverrides {
    14  		if strings.HasPrefix(platform, override.Goos) {
    15  			return override.Format
    16  		}
    17  	}
    18  	return ctx.Config.Archive.Format
    19  }