Skip to content

Instantly share code, notes, and snippets.

@podanypepa
Last active May 28, 2022 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save podanypepa/ff71d7d14f51a384bd81aaca0a4678a0 to your computer and use it in GitHub Desktop.
Save podanypepa/ff71d7d14f51a384bd81aaca0a4678a0 to your computer and use it in GitHub Desktop.
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