1
1
Fork 0
mirror of https://github.com/goreleaser/nfpm synced 2024-05-23 04:56:27 +02:00
nfpm/deprecation/deprecation.go
Carlos Alexandro Becker 2a86957187
feat: add deprecation notice interface (#399)
* feat: add deprecation notice interface

* fix: use a simple writer

* fix: use println
2021-11-12 23:07:18 -03:00

32 lines
680 B
Go

// Package deprecation provides centralized deprecation notice messaging for nfpm.
package deprecation
import (
"fmt"
"io"
"os"
)
type prefixed struct{ io.Writer }
func (p prefixed) Write(b []byte) (int, error) {
return p.Writer.Write(append([]byte("DEPRECATION WARNING: "), b...))
}
var Noticer io.Writer = prefixed{os.Stderr}
// Print prints the given string to the Noticer.
func Print(s string) {
fmt.Fprint(Noticer, s)
}
// Println printslns the given string to the Noticer.
func Println(s string) {
fmt.Fprintln(Noticer, s)
}
// Printf printfs the given string to the Noticer.
func Printf(format string, a ...interface{}) {
fmt.Fprintf(Noticer, format, a...)
}