Golang
Tell us about the most challenging or interesting project in your IT career
When copying a struct with Mutex — is the Mutex copied?
How many bytes does a structure with fields int32, byte, int64 (in that order) occupy?
What does the -mod=readonly flag do during build?
Which category of developers do you consider yourself: a 'task executor' or a 'team superstar'?
How to run something with administrator rights in Linux?
func GetUniqueUserFirstNamesByProjectID(ctx context.Context, projectID string) ([]string, error) { userFirstNames, err := GetUserFirstNamesByProjectID(ctx, projectID) if err != nil { return nil, err } var ( userFirstNamesMap map[string]bool uniqueUserFirstNames []string ) for _, userFirstName := range userFirstNames { if _, ok := userFirstNamesMap[userFirstName]; !ok { userFirstNamesMap[userFirstName] = true uniqueUserFirstNames = append(uniqueUserFirstNames, userFirstName) } } return uniqueUserFirstNames, nil } // users // id first_name project_id func GetUserFirstNamesByProjectID(ctx context.Context, projectID string) ([]string, error) { rows, err := conn.Query(context.Background(), fmt.Sprintf("SELECT first_name from users where project_id = '%s';", projectID)) if err != nil { return nil, err } var userFirstNames []string for rows.Next() { var userFirstName string if err := rows.Scan(&userFirstName); err != nil { return nil, err } userFirstNames = append(userFirstNames, userFirstName) } return userFirstNames, nil }
What is the difference between 'a' - 'A' and why is it needed for case conversion?
Что делает runtime.KeepAlive и в каких случаях она необходима?
[name] have you had experience operating services — working with Kubernetes, Linux, etc.?
How do you earn authority within your team or technical guild, and who do colleagues usually turn to?
How can you protect yourself from the poor outcome of this dubious feature?
// find problems in code.