Config, err := os.Open(Home, "/.backup-light/backup-lightrc", 755)
it gives me errors during compile time
backup-light.go:120: cannot convert "/.backup-light/backup-lightrc" to
type int
backup-light.go:120: cannot use "/.backup-light/backup-lightrc" (type
string) as type int in function argument
As for reading input from the command line I used the example in the
"Go for Dummies" book that is being done by a couple of people here
and they suggest something like this:
func main() {
fmt.Println("Write something:")
in := bufio.NewReader(os.stdin)
result, _ := in.ReadString('\n')
text := strings.TrimSpace(result)
fmt.Println(text)
}
When I try to compile with that I get to following errors:
backup-light.go:124: cannot refer to unexported name os.stdin
backup-light.go:124: undefined: os.stdin
backup-light.go:125: undefined: in
> When I try to compile with that I get to following errors:
>
> backup-light.go:124: cannot refer to unexported name os.stdin
> backup-light.go:124: undefined: os.stdin
> backup-light.go:125: undefined: in
In go, lowercase functions and variables are private to the package they are in.
You're probably looking for os.Stdin <-- note the uppercase 'S'
- jessta
--
=====================
http://jessta.id.au
Home := os.Getenv("HOME")
Config, err := os.Open(Home + "/.backup-light/backup-lightrc",
os.O_RDONLY, 755)
On Sun, Mar 28, 2010 at 1:19 AM, vendion <ven...@gmail.com> wrote:
> Config, err := os.Open(Home, "/.backup-light/backup-lightrc", 755)
I suggest you look that the definition of os.Open again
func Open(name string, flag int, perm int) (file *File, err Error)
http://golang.org/pkg/os/#File.Open
To unsubscribe from this group, send email to golang-nuts+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.