Constructors in Go: how to properly initialize structures?
Hello everyone! I just started learning Go after Java and C#, and I have a misunderstanding about constructors.\n\nIn Java I'm used to writing something like:\n\n```java\npublic class User {\n private String name;\n private int age;\n \n public User(String name, int age) {\n this.name = name;\n this.age = age;\n }\n}\n```\n\nIn Go I see that there is no `class` keyword and no explicit constructors. I tried to do this:\n\n```go\ntype User struct {\n name string\n age int\n}\n\n// Attempt 1: just a function with the same name\nfunc User(name string, age int) User {\n return User{name: name, age: age}\n}\n// Error: User redeclared in this block\n\n// Attempt 2: struct method\nfunc (u User) User(name string, age int) User {\n return User{name: name, age: age}\n}