-
Notifications
You must be signed in to change notification settings - Fork 6
/
deprecationwarning.go
38 lines (31 loc) · 1.23 KB
/
deprecationwarning.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//go:build (go1.16 || go1.17) && !go1.18
// +build go1.16 go1.17
// +build !go1.18
package jsii
import (
"fmt"
"os"
"github.com/aws/jsii-runtime-go/internal/compiler"
"github.com/fatih/color"
"github.com/mattn/go-isatty"
)
// / Emits a deprecation warning message when
func init() {
tty := isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())
if tty {
// Set terminal to bold red
color.Set(color.FgRed, color.Bold)
}
fmt.Fprintln(os.Stderr, "###########################################################")
fmt.Fprintf(os.Stderr, "# This binary was compiled with %v, which has reached #\n", compiler.Version)
fmt.Fprintf(os.Stderr, "# end-of-life on %v. #\n", compiler.EndOfLifeDate)
fmt.Fprintln(os.Stderr, "# #")
fmt.Fprintln(os.Stderr, "# Support for this version WILL be dropped in the future! #")
fmt.Fprintln(os.Stderr, "# #")
fmt.Fprintln(os.Stderr, "# See https://go.dev/security for more information. #")
fmt.Fprintln(os.Stderr, "###########################################################")
if tty {
// Reset terminal back to normal
color.Unset()
}
}