Skip to content

Instantly share code, notes, and snippets.

@podanypepa
Last active May 28, 2022 11:54
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
package main
import "fmt"
type NewApp struct {
Port int
Debug bool
}
func (appCfg NewApp) Create() *App {
a := &App{
Cfg: appCfg,
}
return a
}
type App struct {
Cfg NewApp
}
func (app *App) Run() {
fmt.Printf("app is runnning on port %d\n", app.Cfg.Port)
}
func main() {
myApp := NewApp{Debug: false, Port: 8080}.Create()
myApp.Run()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment