github.com/neomantra/goreleaser@v0.92.0/internal/deprecate/deprecate.go (about)

     1  // Package deprecate provides simple functions to standardize the output
     2  // of deprecation notices on goreleaser
     3  package deprecate
     4  
     5  import (
     6  	"strings"
     7  
     8  	"github.com/apex/log"
     9  	"github.com/apex/log/handlers/cli"
    10  	"github.com/fatih/color"
    11  )
    12  
    13  const baseURL = "https://goreleaser.com/deprecations#"
    14  
    15  // Notice warns the user about the deprecation of the given property
    16  func Notice(property string) {
    17  	cli.Default.Padding += 3
    18  	defer func() {
    19  		cli.Default.Padding -= 3
    20  	}()
    21  	// replaces . and _ with -
    22  	url := baseURL + strings.NewReplacer(
    23  		".", "-",
    24  		"_", "-",
    25  	).Replace(property)
    26  	log.Warn(color.New(color.Bold, color.FgHiYellow).Sprintf(
    27  		"DEPRECATED: `%s` should not be used anymore, check %s for more info.",
    28  		property,
    29  		url,
    30  	))
    31  }