Fsockopen and is_resource in golang

How can we use fsockopen and is_resource in golang?
Here are my PHP codes :

$ex1= @fsockopen($procip, 22);
if (is_resource($ex1)) break;

I wanted to convert these to golang, i’ve find fsockopen equivalent in golang :
conn, err := net.Dial( "tcp" , "google.com:80" )

if err != nil {

fmt.Println( "Error:" , err)



defer conn.Close()

but how do i use is_resource?

Hi @monsterlegend99,

The docs I find about is_resource() on the net are not really chatty about this function but I’d guess that is_resource() returns true if the socket you opened is bound to an external resource that needs cleanup after use.

With a strongly typed language like Go, this check is not necessary. If you open a socket, then your variable is a socket.
(Same for all the other is_* functions I find hereis_bool(),is_array(), etc.)