Golang noob here trying to create a basic standalone package.

The package code is simple and is given below:

package Utils

import (
   "bufio"
   "os"
)

func ReadLine() string {
   scanner := bufio.NewScanner(os.Stdin)
   scanner.Scan()
   return scanner.Text()
}


It works as expected but I get a editor warning (I am using Jetbrains 
Gogland) "Unused function 'ReadLine'". However if I change the function 
name to something like Read instead of ReadLine I don't get the warning. 
Can someone kindly explain why this happens?

Also, what needs to be done to get rid of this "unused function" warning 
while creating standalone packages. If I understand correctly, an exposed 
function in a package is supposed to be invoked by the package consumer and 
is unlikely to be used inside the package itself.

A reference to the Golang documentation where these topics are explained 
would be greatly appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to