Exercises & activities from the go workshop provided by Packt: https://courses.packtpub.com/courses/go
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
372 B

  1. package main
  2. import (
  3. "fmt"
  4. "os"
  5. )
  6. var users = map[string]string{
  7. "305": "Sue",
  8. "204": "Bob",
  9. "631": "Jake",
  10. "073": "Tracy",
  11. }
  12. func deleteUser(id string) {
  13. delete(users, id)
  14. }
  15. func main() {
  16. if len(os.Args) != 2 {
  17. fmt.Println("User ID not passed")
  18. os.Exit(1)
  19. }
  20. userID := os.Args[1]
  21. deleteUser(userID)
  22. fmt.Println("Users:", users)
  23. }