mirror of
https://github.com/bootdotdev/fcc-learn-golang-assets.git
synced 2025-12-17 18:51:17 +00:00
35 lines
635 B
Go
35 lines
635 B
Go
package main
|
|
|
|
import "fmt"
|
|
|
|
type authenticationInfo struct {
|
|
username string
|
|
password string
|
|
}
|
|
|
|
func (authInfo authenticationInfo) getBasicAuth() string {
|
|
return "Authorization: Basic " + authInfo.username + ":" + authInfo.password
|
|
}
|
|
|
|
// don't touch below this line
|
|
|
|
func test(authInfo authenticationInfo) {
|
|
fmt.Println(authInfo.getBasicAuth())
|
|
fmt.Println("====================================")
|
|
}
|
|
|
|
func main() {
|
|
test(authenticationInfo{
|
|
username: "Google",
|
|
password: "12345",
|
|
})
|
|
test(authenticationInfo{
|
|
username: "Bing",
|
|
password: "98765",
|
|
})
|
|
test(authenticationInfo{
|
|
username: "DDG",
|
|
password: "76921",
|
|
})
|
|
}
|