| A module used for testing the symbols logic. |
| |
| -- go.mod -- |
| module example.com/symbols |
| |
| -- README.md -- |
| This is the README for a test module. |
| |
| -- LICENSE -- |
| $MITLicense |
| |
| -- symbols.go -- |
| package symbols |
| |
| // const |
| const C = 1 |
| |
| // const iota |
| const ( |
| AA = iota + 1 |
| _ |
| BB |
| CC |
| ) |
| |
| type Num int |
| |
| const ( |
| DD Num = iota |
| _ |
| EE |
| FF |
| ) |
| |
| // var |
| var V = 2 |
| |
| // Multiple variables on the same line. |
| var A, B string |
| |
| // func |
| func F() {} |
| |
| // type |
| type T int |
| |
| // typeConstant |
| const CT T = 3 |
| |
| // typeVariable |
| var VT T |
| |
| // multi-line var |
| var ( |
| ErrA = errors.New("error A") |
| ErrB = errors.New("error B") |
| ) |
| |
| // typeFunc |
| func TF() T { return T(0) } |
| |
| // method |
| // BUG(uid): this verifies that notes are rendered |
| func (T) M() {} |
| |
| type S1 struct { |
| F int // field |
| } |
| |
| type S2 struct { |
| S1 // embedded struct; should have an id |
| G int |
| } |
| |
| type I1 interface { |
| M1() |
| } |
| |
| type I2 interface { |
| I1 // embedded interface; should not have an id |
| M2() |
| } |
| |
| type ( |
| Int int |
| String bool |
| ) |
| |
| -- hello/hello.go -- |
| // +build linux darwin |
| // +build amd64 |
| |
| package hello |
| |
| // Hello returns a greeting. |
| func Hello() string { |
| return "Hello" |
| } |
| |
| -- hello/hello_js.go -- |
| // +build js,wasm |
| |
| package hello |
| |
| // HelloJS returns a greeting when the build context is js/wasm. |
| func HelloJS() string { |
| return "Hello" |
| } |
| |
| -- multigoos/multigoos.go -- |
| // +build darwin linux windows |
| |
| package multigoos |
| |
| // type FD is introduced for windows, linux and darwin at this version. |
| type FD struct {} |
| |
| -- multigoos/multigoos_windows.go -- |
| // +build windows |
| |
| package multigoos |
| |
| // Different signature from CloseOnExec for linux and darwin. |
| func CloseOnExec(foo string) error { |
| return nil |
| } |
| |
| -- multigoos/multigoos_unix.go -- |
| // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris |
| |
| package multigoos |
| |
| // Different signature from CloseOnExec for windows. |
| func CloseOnExec(num int) (int, error) { |
| return num, nil |
| } |
| |
| -- duplicate/duplicate.go -- |
| // +build linux darwin |
| |
| package duplicate |
| |
| // Unexported here, exported in v1.2.0. |
| type tokenType int |
| |
| // Token types. |
| const ( |
| TokenShort tokenType = iota |
| ) |