Go – Reversing a String

As a little example of basic Golang, I wrote a little app that takes user input and reverses the word as output:

package main

import "fmt"

var userInput string

func main() {

func reverseWord() {

   fmt.Println("Input a word> ")
   var word_length int = len(userInput)
   for i := word_length; i > 0; i-- {
      fmt.Print(userInput[(i - 1):i])