ceth
ceth

Reputation: 45295

How to fix "Undefined ReadFile"

I am going to use ReadFile:

package main

import (
   "fmt"
   "io/ioutil"
)

func main() {
   ReadFile("data.txt")
}

>> undefined: ReadFile

How can I fix it?

Upvotes: 2

Views: 15377

Answers (1)

zmb
zmb

Reputation: 7877

Qualify it with the package name:

package main

import (
    "io/ioutil"
)

func main() {
    ioutil.ReadFile("data.txt")
}

Upvotes: 12

Related Questions