Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / godoc / static / makestatic.go
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // +build ignore
6
7 // Command makestatic writes the generated file buffer to "static.go".
8 // It is intended to be invoked via "go generate" (directive in "gen.go").
9 package main
10
11 import (
12         "fmt"
13         "io/ioutil"
14         "os"
15
16         "golang.org/x/tools/godoc/static"
17 )
18
19 func main() {
20         if err := makestatic(); err != nil {
21                 fmt.Fprintln(os.Stderr, err)
22                 os.Exit(1)
23         }
24 }
25
26 func makestatic() error {
27         buf, err := static.Generate()
28         if err != nil {
29                 return fmt.Errorf("error while generating static.go: %v\n", err)
30         }
31         err = ioutil.WriteFile("static.go", buf, 0666)
32         if err != nil {
33                 return fmt.Errorf("error while writing static.go: %v\n", err)
34         }
35         return nil
36 }