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.

30 lines
455 B

  1. package main
  2. import (
  3. "fmt"
  4. "time"
  5. )
  6. func main() {
  7. var count1 *int
  8. count2 := new(int)
  9. countTemp := 5
  10. count3 := &countTemp
  11. t := &time.Time{}
  12. if count1 != nil {
  13. fmt.Printf("count1: %#v\n", *count1)
  14. }
  15. if count2 != nil {
  16. fmt.Printf("count2: %#v\n", *count2)
  17. }
  18. if count3 != nil {
  19. fmt.Printf("count3: %#v\n", *count3)
  20. }
  21. if t != nil {
  22. fmt.Printf("time: %#v\n", *t)
  23. fmt.Printf("time: %#v\n", t.String())
  24. }
  25. }