.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / mvdan.cc / gofumpt@v0.1.0 / version.go
1 // Copyright (c) 2020, Daniel Martí <mvdan@mvdan.cc>
2 // See LICENSE for licensing information
3
4 package main
5
6 import (
7         "flag"
8         "fmt"
9         "runtime/debug"
10 )
11
12 var (
13         showVersion = flag.Bool("version", false, "show version and exit")
14
15         version = "(devel)" // to match the default from runtime/debug
16 )
17
18 func printVersion() {
19         // don't overwrite the version if it was set by -ldflags=-X
20         if info, ok := debug.ReadBuildInfo(); ok && version == "(devel)" {
21                 mod := &info.Main
22                 if mod.Replace != nil {
23                         mod = mod.Replace
24                 }
25                 version = mod.Version
26         }
27         fmt.Println(version)
28 }