go-hep.org/x/hep@v0.40.0/hep_test.go (about) 1 // Copyright ©2017 The go-hep 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 package hep 6 7 import ( 8 "bytes" 9 "os/exec" 10 "testing" 11 ) 12 13 func TestGofmt(t *testing.T) { 14 cmd := exec.Command("go", "tool", "golang.org/x/tools/cmd/goimports", "-d", "-e", ".") 15 buf := new(bytes.Buffer) 16 cmd.Stdout = buf 17 18 err := cmd.Run() 19 if err != nil { 20 t.Fatalf("error running goimports:\n%s\n%v", buf.String(), err) 21 } 22 23 if len(buf.Bytes()) != 0 { 24 t.Fatalf("some files were not gofmt'ed:\n%s\n", buf.String()) 25 } 26 }