Skip to main content

Command Palette

Search for a command to run...

Lets Start With First Hello world Program

Updated
1 min readView as Markdown
Lets Start With First Hello world Program
S
DevRel at StackGen | Formerly at Deepfence ,Tenable , Accurics | AWS Community Builder also Docker Community Award Winner at Dockercon2020 | CyberSecurity Innovator of Year 2023 award by Bsides Bangalore | Docker/HashiCorp Meetup Organiser Bangalore & Co-Author of Learn Lightweight Kubernetes with k3s (2019) , Packt Publication & also run Non Profit CloudNativeFolks / CloudSecCorner Community To Empower Free Education reach out me twitterhttps://twitter.com/sangamtwts or just follow on GitHub -> https://github.com/sangam14 for Valuable Resources

Lets Start With First Hello world Program


package main

// main package declaration
import "fmt"

// import librares
func main() {
    // declare main function with func keyforword followed by main()
    fmt.Println("Hello World")
    // fmt is fromat
}

// output :- hello_world

Run{:.button.button--outline-success.button--pill}

  • A complete program is created by linking a single, unimported package called the main package with all the packages it imports, transitively. The main package must have package name main and declare a function main that takes no arguments and returns no value.

    func main() { … }

  • Program execution begins by initializing the main package and then invoking the function main. When that function invocation returns, the program exits. It does not wait for other (non-main) goroutines to complete.


  • Go: Meaning of the 'fmt' package acronym
  • fmt is short for format.
  • Package fmt implements formatted I/O with functions analogous to C's printf and scanf. The format 'verbs' are derived from C's but are simpler.

5 views

More from this blog

C

CloudNativeFolks Community

140 posts

CloudNativeFolks is non profit community that empower and educate about cloud native technology !