<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>init on Golang</title><link>https://golang.k5kc.com/tags/init/</link><description>Recent content in init on Golang</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Sun, 16 Aug 2020 00:10:00 +0530</lastBuildDate><atom:link href="https://golang.k5kc.com/tags/init/index.xml" rel="self" type="application/rss+xml"/><item><title>Go - init function</title><link>https://golang.k5kc.com/2020/08/16/init-function/</link><pubDate>Sun, 16 Aug 2020 00:10:00 +0530</pubDate><guid>https://golang.k5kc.com/2020/08/16/init-function/</guid><description>There is a init() function, as the name suggests, it will do some initialization work, such as initializing variables which may not be expressed easily, or calibrating program state. A file can contain one or more init() functions, as shown here:
package main import &amp;#34;fmt&amp;#34; var global int = 0 func init() { global++ fmt.Println(&amp;#34;In first Init(), global is: &amp;#34;, global) } func init() { global++ fmt.Println(&amp;#34;In Second Init(), global is: &amp;#34;, global) } func main() { fmt.</description></item></channel></rss>