1. 15 Apr, 2019 2 commits
    • Yuval Pavel Zholkover's avatar
      cmd/dist: enable cgo for freebsd/arm · 0bd101ce
      Yuval Pavel Zholkover authored
      Change-Id: Icc1a54da848bf446919c0d5470d1e79fad339832
      Reviewed-on: https://go-review.googlesource.com/c/go/+/171727Reviewed-by: default avatarTobias Klauser <tobias.klauser@gmail.com>
      Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
      0bd101ce
    • Daniel Martí's avatar
      go/token: add IsIdentifier, IsKeyword, and IsExported · 60a8dbf3
      Daniel Martí authored
      Telling whether a string is a valid Go identifier can seem like an easy
      task, but it's easy to forget about the edge cases. For example, some
      implementations out there forget that an empty string or keywords like
      "func" aren't valid identifiers.
      
      Add a simple implementation with proper Unicode support, and start using
      it in cmd/cover and cmd/doc. Other pieces of the standard library
      reimplement part of this logic, but don't use a "func(string) bool"
      signature, so we're leaving them untouched for now.
      
      Add some tests too, to ensure that we actually got these edge cases
      correctly.
      
      Since telling whether a string is a valid identifier requires knowing
      that it's not a valid keyword, add IsKeyword too. The internal map was
      already accessible via Lookup, but "Lookup(str) != IDENT" isn't as easy
      to understand as IsKeyword(str). And, as per Josh's suggestion, we could
      have IsKeyword (and probably Lookup too) use a perfect hash function
      instead of a global map.
      
      Finally, for consistency with these new functions, add IsExported. That
      makes go/ast.IsExported a bit redundant, so perhaps it can be deprecated
      in favor of go/token.IsExported in the future. Clarify that
      token.IsExported doesn't imply token.IsIdentifier, to avoid ambiguity.
      
      Fixes #30064.
      
      Change-Id: I0e0e49215fd7e47b603ebc2b5a44086c51ba57f7
      Reviewed-on: https://go-review.googlesource.com/c/go/+/169018
      Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
      TryBot-Result: Gobot Gobot <gobot@golang.org>
      Reviewed-by: default avatarRobert Griesemer <gri@golang.org>
      Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
      60a8dbf3
  2. 14 Apr, 2019 2 commits
  3. 13 Apr, 2019 5 commits
  4. 12 Apr, 2019 11 commits
  5. 11 Apr, 2019 11 commits
  6. 10 Apr, 2019 9 commits