/usr/share/gocode/src/github.com/ttacon/chalk/examples/main.go is in golang-github-ttacon-chalk-dev 0.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | package main
import (
"fmt"
"github.com/ttacon/chalk"
)
func main() {
// You can just use colors
fmt.Println(chalk.Red, "Writing in colors", chalk.Cyan, "is so much fun", chalk.Reset)
fmt.Println(chalk.Magenta.Color("You can use colors to color specific phrases"))
// You can just use text styles
fmt.Println(chalk.Bold.TextStyle("We can have bold text"))
fmt.Println(chalk.Underline.TextStyle("We can have underlined text"))
fmt.Println(chalk.Bold, "But text styles don't work quite like colors :(")
// Or you can use styles
blueOnWhite := chalk.Blue.NewStyle().WithBackground(chalk.White)
fmt.Printf("%s%s%s\n", blueOnWhite, "And they also have backgrounds!", chalk.Reset)
fmt.Println(
blueOnWhite.Style("You can style strings the same way you can color them!"))
fmt.Println(
blueOnWhite.WithTextStyle(chalk.Bold).
Style("You can mix text styles with colors, too!"))
// You can also easily make styling functions thanks to go's functional side
lime := chalk.Green.NewStyle().
WithBackground(chalk.Black).
WithTextStyle(chalk.Bold).
Style
fmt.Println(lime("look at this cool lime text!"))
}
|