Documentation ¶
Overview ¶
Package project defines global project helpers.
Index ¶
- Constants
- Variables
- func AllDigits(val string) bool
- func CanonicalPhoneNumber(phone string, defaultRegion string) (string, error)
- func DefaultHTTPTransport() *http.Transport
- func DevMode() bool
- func ErrorsToStrings(errs []error) []string
- func RandomBase64String(length int) (string, error)
- func RandomBytes(length int) ([]byte, error)
- func RandomHexString(length int) (string, error)
- func Root(more ...string) string
- func TestContext(tb testing.TB) context.Context
- func TestLogger(tb testing.TB) *zap.SugaredLogger
- func TestTimeout() time.Duration
- func TrimSpace(s string) string
- func TrimSpaceAndNonPrintable(s string) string
Constants ¶
const ( // RFC3339Date formats time as RFC3339 but without a time component (e.g. // 2020-11-24 for November 24, 20202). RFC3339Date = "2006-01-02" // RFC3339Squish is the RFC3339 datetime but all dashes and timezone // indicators are removed. This is useful for filenames. RFC3339Squish = "20060102150405" )
const ( // PasswordSentinel is the password string inserted into forms. PasswordSentinel = "very-nice-try-maybe-next-time" //nolint:gosec )
const StatsDisplayDays = 90
StatsDisplayDays is the number of days for which to display statistics. This is separate from stats retention, which is controlled by the cleanup job.
const TestPhoneNumber = "+18558361987"
TestPhoneNumber is a test phone number to use for tests. It's a "real" phone number (Google's support phone number), but none of the tests actually send SMS.
Variables ¶
var DebugGoogleCloudResponses, _ = strconv.ParseBool(os.Getenv("DEBUG_GOOGLE_CLOUD_RESPONSES"))
DebugGoogleCloudResponses controls whether HTTP requests should request GFE debug headers. This should be off by default as it greatly increases the size of response payloads.
var SkipE2ESMS, _ = strconv.ParseBool(os.Getenv("E2E_SKIP_SMS"))
SkipE2ESMS controls whether the e2e runners use SMS.
Functions ¶
func CanonicalPhoneNumber ¶ added in v1.2.0
CanonicalPhoneNumber returns the E.164 formatted phone number.
func DefaultHTTPTransport ¶ added in v1.3.0
DefaultHTTPTransport returns a clean, non-globally-modifiable HTTP transport with similar defaults as http.DefaultTransport.
func DevMode ¶ added in v0.23.0
func DevMode() bool
DevMode indicates whether the project is running in development mode.
func ErrorsToStrings ¶ added in v0.20.0
ErrorsToStrings converts a list of errors to a list of strings of those error's Error() value, excluding any nil errors.
func RandomBase64String ¶ added in v0.18.0
RandomBase64String encodes a random base64 string of a given length.
func RandomBytes ¶ added in v0.19.0
RandomBytes returns a byte slice of random values of the given length.
func RandomHexString ¶ added in v0.19.0
RandomHexString generates a random string of the provided length.
func TestContext ¶ added in v0.19.0
TestContext returns a context with test values pre-populated.
func TestLogger ¶ added in v0.19.0
func TestLogger(tb testing.TB) *zap.SugaredLogger
TestLogger returns a logger configured for test. See the following link for more information:
https://pkg.go.dev/go.uber.org/zap/zaptest
func TestTimeout ¶ added in v0.23.0
TestTimeout controls the individual test timeout, primarily used on a context for chromedp tests. By default, it's 1min, but it can be controlled with the TEST_TIMEOUT environment variable.
func TrimSpaceAndNonPrintable ¶ added in v0.16.0
TrimSpaceAndNonPrintable trims spaces and non-printable chars from the beginning and end of a string.
Types ¶
This section is empty.