func isUserValid(username, password string) bool {
	for _, u := range userList {
		if u.Username == username && u.Password == password {
			return true
		}
	}
	return false
}
Check if the username and password combination is valid
package main
import (
	"errors"
	"strings"
)
type user struct {
	Username string `json:"username"`
	Password string `json:"-"`
}
var userList = []user{
	user{Username: "user1", Password: "pass1"},
	user{Username: "user2", Password: "pass2"},
	user{Username: "user3", Password: "pass3"},
}