To find the current year in Go, we can use the time package. Specifically, we can use the Now() function to get the current time, and then extract the year component using the Year() method.
Here's an example:
main.go146 chars12 linesIn this code, we first import the fmt and time packages. Then, we call the Now() function to get the current time, and extract the year component using the Year() method. Finally, we print the current year using fmt.Println().
gistlibby LogSnag