blob: ecf25643f54b73baf0aaf2123b78653c5f7ce293 [file] [log] [blame]
package abc
import (
"fmt"
"math"
"net"
)
// ABC is a struct, you coudn't use Goto Definition or Hover info on this before
// Now you can due to gogetdoc and go doc
type ABC struct {
a int
b int
c int
}
// This is an unexported function so couldn't get this comment on hover :(
// Not anymore!!
func print(txt string) {
fmt.Println(txt)
}
func main() {
print("Hello")
}
// Hello is a method on the struct ABC. Will signature help understand this correctly
func (abcd *ABC) Hello(s string, exclaim bool) string {
net.IPv4Mask(0, 0, 0, 0)
if exclaim {
s = s + "!"
}
if abcd.a+abcd.b+abcd.c > 3 {
return "Hello " + s
}
return "GoodBye " + s
}
// Greetings is an exported function. So all is good.
func Greetings() string {
xyz := ABC{1, 2, int(math.Abs(-1))}
return xyz.Hello("World", false) + EmptyLine("Why")
}
// EmptyLine has docs
//
// with a blank line in the middle
func EmptyLine(s string) string {
return s + "this is not an empty line"
}