post image January 6, 2022 | 1 min Read

Go methods

package main

import (
	"fmt"
	// "strconv"
	// "math"
	// "reflect"
	// "net/http"
	// "log"

)


type greeter struct {
	greeting string
	name string
}

func (g greeter) greet() {
	fmt.Printf("%v: %v\n", g.greeting, g.name)
}

func main()  {
	a := greeter{
		greeting: "Hello",
		name: "Gooers!",
	}

	a.greet()
}



author image

Jan Toth

I have been in DevOps related jobs for past 6 years dealing mainly with Kubernetes in AWS and on-premise as well. I spent quite a lot …

comments powered by Disqus