A lightweight mechanism to provide an *instant kickstart* to a Go web server instance upon changing any Go source files under the project directory (and its subdirectories).

str.go 611B

1234567891011121314151617181920212223242526
  1. // Copyright 2009 The Go Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // +build darwin dragonfly freebsd linux netbsd openbsd solaris
  5. package unix
  6. func itoa(val int) string { // do it here rather than with fmt to avoid dependency
  7. if val < 0 {
  8. return "-" + uitoa(uint(-val))
  9. }
  10. return uitoa(uint(val))
  11. }
  12. func uitoa(val uint) string {
  13. var buf [32]byte // big enough for int64
  14. i := len(buf) - 1
  15. for val >= 10 {
  16. buf[i] = byte(val%10 + '0')
  17. i--
  18. val /= 10
  19. }
  20. buf[i] = byte(val + '0')
  21. return string(buf[i:])
  22. }