import “os”

func main() {

     file, _ := os.Open(os.Args[1])

myfunc(file)

}

func myfunc(file ???) {

}

What type should I use to declare “file” in the parameter list for 
myfunc()? 


This argument doesn't seem logical to me. If I fully declare `file` in this 
case, I also have to know which type to declare it as:

     var file ???;
    file, _ = os.Open(...)

This will also be a "distraction and waste time". I'm all for explicit 
declarations in cases where they add clarity, but in idiomatic cases, I 
don't feel it adds anything useful.

Additionally, in cases where I am creating a new function to work with the 
variable, surely I'm aware of more context concerning the API, e.g. in the 
example, I'll assume `file` has `Read` and `Close`, but passing the 
variable along, I would assume the operation on the variable will be more 
involved and requiring reading the documentation anyway ... 

     -tim





 

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/f6c9bafb-50a9-4e40-b091-59988417ebffn%40googlegroups.com.

Reply via email to