Answer the question
In order to leave comments, you need to log in
How to add a custom property to an existing Go structure?
Greetings!
I get a TCP connection with the following code:
ln, err := net.Listen("tcp", Server.GetHost()+Server.getPortForNet())
for {
connection, err := ln.Accept()
}
?{
name string
lastname string
}
func (Connection *?) GetName() string {
return ?.name
}
func (Connection *?) GetLastName() string {
return ?.lastname
}
connection.getName()
Answer the question
In order to leave comments, you need to log in
Why don't you just want to create a structure like this?
struct User {
Name string
LastName string
Connection net.Conn
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question