1
0
mirror of https://github.com/amix/vimrc synced 2025-07-09 10:45:00 +08:00

Add support with Go language.

This commit is contained in:
Kurtis Moxley
2022-05-27 20:16:55 +08:00
parent 71e3f2fa49
commit de80db5969
205 changed files with 29172 additions and 0 deletions

View File

@ -0,0 +1,5 @@
package main
func main() {
notafunc()
}

View File

@ -0,0 +1,9 @@
package complete
type T struct {
V string
}
func Example(s string) {
Example("")
}

View File

@ -0,0 +1,5 @@
package config
func Example() {
foo()
}

View File

@ -0,0 +1,8 @@
// +build constrained
package config
// foo is constrained and this comment exists to make the line numbers different than foo.go
func foo() {
println("foo")
}

View File

@ -0,0 +1,7 @@
// +build !constrained
package config
func foo() {
println("foo")
}

View File

@ -0,0 +1,3 @@
module config
go 1.13

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go"
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,8 @@
package main
func Foo(log *logging.TestLogger) {
log.Debug("vim-go")
}
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,15 @@
package main
import (
"fmt"
logging "gh.com/gi/foo-logging"
)
func Foo(log *logging.TestLogger) {
log.Debug("vim-go")
}
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,12 @@
package logging
import "fmt"
type TestLogger struct {
Value string
}
func (l *TestLogger) Debug(msg string) {
fmt.Println(msg)
fmt.Println(l.Value)
}

View File

@ -0,0 +1,6 @@
package main
func main() {
notafunc()
println("vim-go")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go"
}

View File

@ -0,0 +1,10 @@
package errcheck
import (
"io"
"os"
)
func foo() {
io.Copy(os.Stdout, os.Stdin)
}

View File

@ -0,0 +1,11 @@
package errcheck
import (
"io"
"os"
"testing"
)
func TestFoo(t *testing.T) {
io.Copy(os.Stdout, os.Stdin)
}

View File

@ -0,0 +1,3 @@
module vim-go.test/errcheck
go 1.16

View File

@ -0,0 +1,7 @@
package foo
import "fmt"
func MissingFooDoc() {
fmt.Println("missing doc")
}

View File

@ -0,0 +1,3 @@
module vim-go.test/foo
go 1.16

View File

@ -0,0 +1,3 @@
package lint
func baz() {}

View File

@ -0,0 +1,3 @@
module vim-go.test/lint
go 1.16

View File

@ -0,0 +1,3 @@
package problems
func bar() {}

View File

@ -0,0 +1,5 @@
package problems
import "/quux"
func baz() {}

View File

@ -0,0 +1,9 @@
package problems
import (
"time"
)
func mySleep(time int) {
time.Sleep(500 * time.Millisecond)
}

View File

@ -0,0 +1,5 @@
package problems
func mySleep(time int) {
time.Sleep(500 * time.Millisecond)
}

View File

@ -0,0 +1,7 @@
package lint
import "fmt"
func MissingDoc() {
fmt.Println("missing doc")
}

View File

@ -0,0 +1,7 @@
package lint
import "fmt"
func AlsoMissingDoc() {
fmt.Println("missing doc")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go"
}

View File

@ -0,0 +1,3 @@
module vim-go.test/vet
go 1.16

View File

@ -0,0 +1,8 @@
package main
import "fmt"
func main() {
str := "hello world!"
fmt.Printf("%d\n", str)
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,6 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,10 @@
package main
import (
"fmt"
)
func main() {
io.Copy(ioutil.Discard, os.Stdin)
fmt.Println("vim-go")
}

View File

@ -0,0 +1,13 @@
package main
import (
"fmt"
"io"
"io/ioutil"
"os"
)
func main() {
io.Copy(ioutil.Discard, os.Stdin)
fmt.Println("vim-go")
}

View File

@ -0,0 +1,3 @@
module package
go 1.12

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go")
}

View File

@ -0,0 +1,5 @@
package main
func main() {
println("hello, world")
}

View File

@ -0,0 +1 @@
/pkg

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Println("vim-go"
}

View File

@ -0,0 +1,3 @@
module vim-go.test/compilerror
go 1.16

View File

@ -0,0 +1,10 @@
package main
import (
"fmt"
)
func ExampleHelloWorld() {
fmt.Println("Hello, World")
// Output: What's shakin
}

View File

@ -0,0 +1,3 @@
module vim-go.test/example
go 1.16

View File

@ -0,0 +1,3 @@
module vim-go.test/play
go 1.16

View File

@ -0,0 +1,7 @@
package mock
import "testing"
func Fail(t *testing.T) {
t.Fatal("another package badness")
}

View File

@ -0,0 +1,59 @@
package play
import (
"sync"
"testing"
"vim-go.test/play/mock"
)
func TestTopSubHelper(t *testing.T) {
t.Run("sub", func(t *testing.T) {
t.Log("log message")
t.Error("sub badness")
})
t.Error("badness")
helper(t)
}
func TestMultiline(t *testing.T) {
t.Error("this is an error\nand a second line, too")
t.Error("\nthis is another error")
}
func TestSub(t *testing.T) {
t.Run("indented", func(t *testing.T) {
t.Error("this is a sub-test error\nand a second line, too")
})
}
func TestOK(t *testing.T) {
t.Run("log", func(t *testing.T) {
t.Log("goodness")
})
}
// TestMocked tests behavior similar to what users may experience when using
// github.com/golang/mock/gomock.
func TestMocked(t *testing.T) {
mock.Fail(t)
}
func TestPanic(t *testing.T) {
panic("worst ever")
}
func TestConcurrentPanic(t *testing.T) {
var wg sync.WaitGroup
wg.Add(1)
go func() {
panic("concurrent fail")
wg.Done()
}()
wg.Wait()
}
func helper(t *testing.T) {
t.Helper()
t.Fatal("helper badness")
}

View File

@ -0,0 +1,3 @@
module vim-go.test/showname
go 1.16

View File

@ -0,0 +1,11 @@
package main
import "testing"
func TestHelloWorld(t *testing.T) {
t.Error("so long")
t.Run("sub", func(t *testing.T) {
t.Error("thanks for all the fish")
})
}

View File

@ -0,0 +1,3 @@
module vim-go.test/testcompilerror
go 1.16

View File

@ -0,0 +1,11 @@
package main
import (
"io/ioutil"
"testing"
)
func TestSomething(t *testing.T) {
r := struct{}{}
ioutil.ReadAll(r)
}

View File

@ -0,0 +1,3 @@
module vim-go.test/timeout
go 1.16

View File

@ -0,0 +1,47 @@
// Run a few parallel tests, all in parallel, using multiple techniques for
// causing the test to take a while so that the stacktraces resulting from a
// test timeout will contain several goroutines to avoid giving a false sense
// of confidence or creating error formats that don't account for the more
// complex scenarios that can occur with timeouts.
package main
import (
"testing"
"time"
)
func TestSleep(t *testing.T) {
t.Parallel()
time.Sleep(15 * time.Second)
t.Log("expected panic if run with timeout < 15s")
}
func TestRunning(t *testing.T) {
t.Parallel()
c := time.After(15 * time.Second)
Loop:
for {
select {
case <-c:
break Loop
default:
}
}
t.Log("expected panic if run with timeout < 15s")
}
func TestRunningAlso(t *testing.T) {
t.Parallel()
c := time.After(15 * time.Second)
Loop:
for {
select {
case <-c:
break Loop
default:
}
}
t.Log("expected panic if run with timeout < 15s")
}

View File

@ -0,0 +1,3 @@
module vim-go.test/veterror
go 1.16

View File

@ -0,0 +1,7 @@
package main
import "fmt"
func main() {
fmt.Errorf("%v")
}