DEV Community

loading...

Discussion on: function Undefined in go

Collapse
5anthosh profile image
Santhosh Kumar

You can use markdown syntax to present the code better

Example

package main

import (
"fmt"
)

type MyStruct struct {
name string
id int64
}

var (
s MyStruct
u int
)

func (u MyStruct) register() {
fmt.Println(u.name, u.id)
fmt.Println(u.name, u.id)
fmt.Println(u)
s.name = "vij"
fmt.Println(u)

}

func main() {

s := MyStruct{"deb", 11273090}
r := register()
fmt.Print("Inside Main****")
fmt.Print(s)

}
Collapse
debbiswasgit profile image
debbiswas Author

Hi Santhosh, thanks for the suggestion. The thing is that when i format the code written in [I'm an inline link]play.golang.org/ it automatically indents the body.