From 6e2cb00008cbf09e556b00f87603797fcaa47e09 Mon Sep 17 00:00:00 2001 From: Christopher Speller Date: Mon, 16 Apr 2018 05:37:14 -0700 Subject: Depenancy upgrades and movign to dep. (#8630) --- vendor/golang.org/x/text/cmd/gotext/common.go | 49 --- vendor/golang.org/x/text/cmd/gotext/doc.go | 53 --- .../x/text/cmd/gotext/examples/extract/catalog.go | 84 ----- .../extract/locales/de/messages.gotext.json | 186 ---------- .../examples/extract/locales/de/out.gotext.json | 137 -------- .../extract/locales/en-US/messages.gotext.json | 82 ----- .../examples/extract/locales/en-US/out.gotext.json | 154 --------- .../extract/locales/zh/messages.gotext.json | 203 ----------- .../examples/extract/locales/zh/out.gotext.json | 137 -------- .../x/text/cmd/gotext/examples/extract/main.go | 86 ----- .../gotext/examples/extract_http/catalog_gen.go | 57 ---- .../extract_http/locales/de/out.gotext.json | 39 --- .../extract_http/locales/en-US/out.gotext.json | 39 --- .../extract_http/locales/en/out.gotext.json | 39 --- .../extract_http/locales/zh/out.gotext.json | 35 -- .../text/cmd/gotext/examples/extract_http/main.go | 17 - .../cmd/gotext/examples/extract_http/pkg/pkg.go | 25 -- .../x/text/cmd/gotext/examples/rewrite/main.go | 37 -- .../x/text/cmd/gotext/examples/rewrite/printer.go | 16 - vendor/golang.org/x/text/cmd/gotext/extract.go | 40 --- vendor/golang.org/x/text/cmd/gotext/generate.go | 31 -- vendor/golang.org/x/text/cmd/gotext/main.go | 375 --------------------- vendor/golang.org/x/text/cmd/gotext/rewrite.go | 55 --- vendor/golang.org/x/text/cmd/gotext/update.go | 52 --- 24 files changed, 2028 deletions(-) delete mode 100644 vendor/golang.org/x/text/cmd/gotext/common.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/doc.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json delete mode 100755 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/rewrite/main.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/examples/rewrite/printer.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/extract.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/generate.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/main.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/rewrite.go delete mode 100644 vendor/golang.org/x/text/cmd/gotext/update.go (limited to 'vendor/golang.org/x/text/cmd/gotext') diff --git a/vendor/golang.org/x/text/cmd/gotext/common.go b/vendor/golang.org/x/text/cmd/gotext/common.go deleted file mode 100644 index 51322db65..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/common.go +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - "go/build" - "go/parser" - - "golang.org/x/tools/go/loader" -) - -const ( - extractFile = "extracted.gotext.json" - outFile = "out.gotext.json" - gotextSuffix = ".gotext.json" -) - -// NOTE: The command line tool already prefixes with "gotext:". -var ( - wrap = func(err error, msg string) error { - if err == nil { - return nil - } - return fmt.Errorf("%s: %v", msg, err) - } - errorf = fmt.Errorf -) - -// TODO: still used. Remove when possible. -func loadPackages(conf *loader.Config, args []string) (*loader.Program, error) { - if len(args) == 0 { - args = []string{"."} - } - - conf.Build = &build.Default - conf.ParserMode = parser.ParseComments - - // Use the initial packages from the command line. - args, err := conf.FromArgs(args, false) - if err != nil { - return nil, wrap(err, "loading packages failed") - } - - // Load, parse and type-check the whole program. - return conf.Load() -} diff --git a/vendor/golang.org/x/text/cmd/gotext/doc.go b/vendor/golang.org/x/text/cmd/gotext/doc.go deleted file mode 100644 index 2a274f76e..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/doc.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by go generate. DO NOT EDIT. - -// gotext is a tool for managing text in Go source code. -// -// Usage: -// -// gotext command [arguments] -// -// The commands are: -// -// extract extracts strings to be translated from code -// rewrite rewrites fmt functions to use a message Printer -// generate generates code to insert translated messages -// -// Use "go help [command]" for more information about a command. -// -// Additional help topics: -// -// -// Use "gotext help [topic]" for more information about that topic. -// -// -// Extracts strings to be translated from code -// -// Usage: -// -// go extract * -// -// -// -// -// Rewrites fmt functions to use a message Printer -// -// Usage: -// -// go rewrite -// -// rewrite is typically done once for a project. It rewrites all usages of -// fmt to use x/text's message package whenever a message.Printer is in scope. -// It rewrites Print and Println calls with constant strings to the equivalent -// using Printf to allow translators to reorder arguments. -// -// -// Generates code to insert translated messages -// -// Usage: -// -// go generate -// -// -// -// -package main diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go deleted file mode 100644 index bc6130a69..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/catalog.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" - "golang.org/x/text/message/catalog" -) - -type dictionary struct { - index []uint32 - data string -} - -func (d *dictionary) Lookup(key string) (data string, ok bool) { - p := messageKeyToIndex[key] - start, end := d.index[p], d.index[p+1] - if start == end { - return "", false - } - return d.data[start:end], true -} - -func init() { - dict := map[string]catalog.Dictionary{ - "de": &dictionary{index: deIndex, data: deData}, - "en_US": &dictionary{index: en_USIndex, data: en_USData}, - "zh": &dictionary{index: zhIndex, data: zhData}, - } - fallback := language.MustParse("en-US") - cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback)) - if err != nil { - panic(err) - } - message.DefaultCatalog = cat -} - -var messageKeyToIndex = map[string]int{ - "%.2[1]f miles traveled (%[1]f)": 8, - "%[1]s is visiting %[3]s!\n": 3, - "%d files remaining!": 5, - "%d more files remaining!": 4, - "%s is out of order!": 7, - "%s is visiting %s!\n": 2, - "Hello %s!\n": 1, - "Hello world!\n": 0, - "Use the following code for your discount: %d\n": 6, -} - -var deIndex = []uint32{ // 10 elements - 0x00000000, 0x00000011, 0x00000023, 0x0000003d, - 0x00000057, 0x00000076, 0x00000076, 0x00000076, - 0x00000076, 0x00000076, -} // Size: 64 bytes - -const deData string = "" + // Size: 118 bytes - "\x04\x00\x01\x0a\x0c\x02Hallo Welt!\x04\x00\x01\x0a\x0d\x02Hallo %[1]s!" + - "\x04\x00\x01\x0a\x15\x02%[1]s besucht %[2]s!\x04\x00\x01\x0a\x15\x02%[1]" + - "s besucht %[3]s!\x02Noch %[1]d Bestände zu gehen!" - -var en_USIndex = []uint32{ // 10 elements - 0x00000000, 0x00000012, 0x00000024, 0x00000042, - 0x00000060, 0x000000a3, 0x000000ba, 0x000000ef, - 0x00000106, 0x00000125, -} // Size: 64 bytes - -const en_USData string = "" + // Size: 293 bytes - "\x04\x00\x01\x0a\x0d\x02Hello world!\x04\x00\x01\x0a\x0d\x02Hello %[1]sn" + - "\x04\x00\x01\x0a\x19\x02%[1]s is visiting %[2]s!\x04\x00\x01\x0a\x19\x02" + - "%[1]s is visiting %[3]s!\x14\x01\x81\x01\x00\x02\x14\x02One file remaini" + - "ng!\x00&\x02There are %[1]d more files remaining!\x02%[1]d files remaini" + - "ng!\x04\x00\x01\x0a0\x02Use the following code for your discount: %[1]d" + - "\x02%[1]s is out of order!\x02%.2[1]f miles traveled (%[1]f)" - -var zhIndex = []uint32{ // 10 elements - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, -} // Size: 64 bytes - -const zhData string = "" - -// Total table size 603 bytes (0KiB); checksum: 1D2754EE diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json deleted file mode 100755 index 5e1d3b396..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/messages.gotext.json +++ /dev/null @@ -1,186 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hallo Welt!", - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hallo {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:31:10" - }, - { - "id": "Hello {Town}!", - "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "Hallo {Town}!", - "placeholders": [ - { - "id": "Town", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "town", - "comment": "Town" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:35:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:40:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "comment": "Person visiting a place.", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "pp.Person" - }, - { - "id": "Place", - "string": "%[3]s", - "type": "string", - "underlyingType": "string", - "argNum": 3, - "expr": "pp.Place", - "comment": "Place the person is visiting." - }, - { - "id": "Extra", - "string": "%[2]v", - "type": "int", - "underlyingType": "int", - "argNum": 2, - "expr": "pp.extra" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:55:10" - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:67:10" - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:73:10" - }, - { - "id": [ "msgOutOfOrder", "{Device} is out of order!" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "", - "comment": "FOO\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:81:10" - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:85:10" - } - ] -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json deleted file mode 100755 index 696eeb70e..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/de/out.gotext.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hallo Welt!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hallo {City}!", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} besucht {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "Noch {N} Bestände zu gehen!", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "FOO\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json deleted file mode 100755 index 5f6f8b03c..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/messages.gotext.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "Hello world!", - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "Hello {City}n" - }, - { - "id": "Hello {Town}!", - "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "Hello {Town}!", - "placeholders": [ - { - "id": "Town", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "town", - "comment": "Town" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!\n" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", - "comment": "Person visiting a place." - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": "One file remaining!", - "other": "There are {N} more files remaining!" - } - } - } - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "" - }, - { - "id": [ "msgOutOfOrder", "{Device} is out of order!" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "{Device} is out of order!", - "comment": "FOO\n" - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})" - } - ] -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json deleted file mode 100755 index 31785bf80..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/en-US/out.gotext.json +++ /dev/null @@ -1,154 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "Hello world!" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "Hello {City}n", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "{Person} is visiting {Place}!", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "{2} files remaining!", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ], - "fuzzy": true - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": { - "select": { - "feature": "plural", - "arg": "N", - "cases": { - "one": { - "msg": "One file remaining!" - }, - "other": { - "msg": "There are {N} more files remaining!" - } - } - } - }, - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "Use the following code for your discount: {ReferralCode}", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "fuzzy": true - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "{Device} is out of order!", - "comment": "FOO\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "{Miles} miles traveled ({Miles_1})", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json deleted file mode 100755 index 9913f832b..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/messages.gotext.json +++ /dev/null @@ -1,203 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello world!", - "key": "Hello world!\n", - "message": "Hello world!", - "translation": "", - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:27:10" - }, - { - "id": "Hello {City}!", - "key": "Hello %s!\n", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:31:10" - }, - { - "id": "Hello {Town}!", - "key": "Hello %s!\n", - "message": "Hello {Town}!", - "translation": "", - "placeholders": [ - { - "id": "Town", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "town", - "comment": "Town" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:35:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%s is visiting %s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:40:10" - }, - { - "id": "{Person} is visiting {Place}!", - "key": "%[1]s is visiting %[3]s!\n", - "message": "{Person} is visiting {Place}!", - "translation": "", - "comment": "Person visiting a place.", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "pp.Person" - }, - { - "id": "Place", - "string": "%[3]s", - "type": "string", - "underlyingType": "string", - "argNum": 3, - "expr": "pp.Place", - "comment": "Place the person is visiting." - }, - { - "id": "Extra", - "string": "%[2]v", - "type": "int", - "underlyingType": "int", - "argNum": 2, - "expr": "pp.extra" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:55:10" - }, - { - "id": "{} files remaining!", - "key": "%d files remaining!", - "message": "{} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:62:10" - }, - { - "id": "{N} more files remaining!", - "key": "%d more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:67:10" - }, - { - "id": "Use the following code for your discount: {ReferralCode}\n", - "key": "Use the following code for your discount: %d\n", - "message": "Use the following code for your discount: {ReferralCode}\n", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:73:10" - }, - { - "id": [ "{Device} is out of order!", "msgOutOfOrder" ], - "key": "%s is out of order!", - "message": "{Device} is out of order!", - "translation": "", - "comment": "FOO\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:81:10" - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "key": "%.2[1]f miles traveled (%[1]f)", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract/main.go:85:10" - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json deleted file mode 100755 index 946573ec6..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/locales/zh/out.gotext.json +++ /dev/null @@ -1,137 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello world!", - "message": "Hello world!", - "translation": "" - }, - { - "id": "Hello {City}!", - "message": "Hello {City}!", - "translation": "", - "placeholders": [ - { - "id": "City", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "city" - } - ] - }, - { - "id": "{Person} is visiting {Place}!", - "message": "{Person} is visiting {Place}!", - "translation": "", - "placeholders": [ - { - "id": "Person", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "person", - "comment": "The person of matter." - }, - { - "id": "Place", - "string": "%[2]s", - "type": "string", - "underlyingType": "string", - "argNum": 2, - "expr": "place", - "comment": "Place the person is visiting." - } - ] - }, - { - "id": "{2} files remaining!", - "message": "{2} files remaining!", - "translation": "", - "placeholders": [ - { - "id": "2", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "2" - } - ] - }, - { - "id": "{N} more files remaining!", - "message": "{N} more files remaining!", - "translation": "", - "placeholders": [ - { - "id": "N", - "string": "%[1]d", - "type": "int", - "underlyingType": "int", - "argNum": 1, - "expr": "n" - } - ] - }, - { - "id": "Use the following code for your discount: {ReferralCode}", - "message": "Use the following code for your discount: {ReferralCode}", - "translation": "", - "placeholders": [ - { - "id": "ReferralCode", - "string": "%[1]d", - "type": "golang.org/x/text/cmd/gotext/examples/extract.referralCode", - "underlyingType": "int", - "argNum": 1, - "expr": "c" - } - ] - }, - { - "id": [ - "msgOutOfOrder", - "{Device} is out of order!" - ], - "message": "{Device} is out of order!", - "translation": "", - "comment": "FOO\n", - "placeholders": [ - { - "id": "Device", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "device" - } - ] - }, - { - "id": "{Miles} miles traveled ({Miles_1})", - "message": "{Miles} miles traveled ({Miles_1})", - "translation": "", - "placeholders": [ - { - "id": "Miles", - "string": "%.2[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - }, - { - "id": "Miles_1", - "string": "%[1]f", - "type": "float64", - "underlyingType": "float64", - "argNum": 1, - "expr": "miles" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go deleted file mode 100644 index 414b4531a..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract/main.go +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -//go:generate gotext update -out catalog.go - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" -) - -func main() { - p := message.NewPrinter(language.English) - - p.Print("Hello world!\n") - - p.Println("Hello", "world!") - - person := "Sheila" - place := "Zürich" - - p.Print("Hello ", person, " in ", place, "!\n") - - // Greet everyone. - p.Printf("Hello world!\n") - - city := "Amsterdam" - // Greet a city. - p.Printf("Hello %s!\n", city) - - town := "Amsterdam" - // Greet a town. - p.Printf("Hello %s!\n", - town, // Town - ) - - // Person visiting a place. - p.Printf("%s is visiting %s!\n", - person, // The person of matter. - place, // Place the person is visiting. - ) - - pp := struct { - Person string // The person of matter. // TODO: get this comment. - Place string - extra int - }{ - person, place, 4, - } - - // extract will drop this comment in favor of the one below. - // argument is added as a placeholder. - p.Printf("%[1]s is visiting %[3]s!\n", // Person visiting a place. - pp.Person, - pp.extra, - pp.Place, // Place the person is visiting. - ) - - // Numeric literal - p.Printf("%d files remaining!", 2) - - const n = 2 - - // Numeric var - p.Printf("%d more files remaining!", n) - - // Infer better names from type names. - type referralCode int - - const c = referralCode(5) - p.Printf("Use the following code for your discount: %d\n", c) - - // Using a constant for a message will cause the constant name to be - // added as an identifier, allowing for stable message identifiers. - - // Explain that a device is out of order. - const msgOutOfOrder = "%s is out of order!" // FOO - const device = "Soda machine" - p.Printf(msgOutOfOrder, device) - - // Double arguments. - miles := 1.2345 - p.Printf("%.2[1]f miles traveled (%[1]f)", miles) -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go deleted file mode 100644 index 2c410dcdb..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/catalog_gen.go +++ /dev/null @@ -1,57 +0,0 @@ -// Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" - "golang.org/x/text/message/catalog" -) - -type dictionary struct { - index []uint32 - data string -} - -func (d *dictionary) Lookup(key string) (data string, ok bool) { - p := messageKeyToIndex[key] - start, end := d.index[p], d.index[p+1] - if start == end { - return "", false - } - return d.data[start:end], true -} - -func init() { - dict := map[string]catalog.Dictionary{ - "en": &dictionary{index: enIndex, data: enData}, - "zh": &dictionary{index: zhIndex, data: zhData}, - } - fallback := language.MustParse("en") - cat, err := catalog.NewFromMap(dict, catalog.Fallback(fallback)) - if err != nil { - panic(err) - } - message.DefaultCatalog = cat -} - -var messageKeyToIndex = map[string]int{ - "Do you like your browser (%s)?\n": 1, - "Hello %s!\n": 0, -} - -var enIndex = []uint32{ // 3 elements - 0x00000000, 0x00000012, 0x00000039, -} // Size: 36 bytes - -const enData string = "" + // Size: 57 bytes - "\x04\x00\x01\x0a\x0d\x02Hello %[1]s!\x04\x00\x01\x0a\x22\x02Do you like " + - "your browser (%[1]s)?" - -var zhIndex = []uint32{ // 3 elements - 0x00000000, 0x00000000, 0x00000000, -} // Size: 36 bytes - -const zhData string = "" - -// Total table size 129 bytes (0KiB); checksum: 9C146C82 diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json deleted file mode 100755 index d8437c01f..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/de/out.gotext.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "language": "de", - "messages": [ - { - "id": "Hello {From}!", - "key": "Hello %s!\n", - "message": "Hello {From}!", - "translation": "", - "placeholders": [ - { - "id": "From", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"From\")" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" - }, - { - "id": "Do you like your browser ({User_Agent})?", - "key": "Do you like your browser (%s)?\n", - "message": "Do you like your browser ({User_Agent})?", - "translation": "", - "placeholders": [ - { - "id": "User_Agent", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"User-Agent\")" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:24:11" - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json deleted file mode 100755 index de59eca1d..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en-US/out.gotext.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "language": "en-US", - "messages": [ - { - "id": "Hello {From}!", - "key": "Hello %s!\n", - "message": "Hello {From}!", - "translation": "", - "placeholders": [ - { - "id": "From", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"From\")" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:22:11" - }, - { - "id": "Do you like your browser ({User_Agent})?", - "key": "Do you like your browser (%s)?\n", - "message": "Do you like your browser ({User_Agent})?", - "translation": "", - "placeholders": [ - { - "id": "User_Agent", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"User-Agent\")" - } - ], - "position": "golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go:24:11" - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json deleted file mode 100644 index 1391e5848..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/en/out.gotext.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "language": "en", - "messages": [ - { - "id": "Hello {From}!", - "message": "Hello {From}!", - "translation": "Hello {From}!", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "From", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"From\")" - } - ], - "fuzzy": true - }, - { - "id": "Do you like your browser ({User_Agent})?", - "message": "Do you like your browser ({User_Agent})?", - "translation": "Do you like your browser ({User_Agent})?", - "translatorComment": "Copied from source.", - "placeholders": [ - { - "id": "User_Agent", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"User-Agent\")" - } - ], - "fuzzy": true - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json deleted file mode 100755 index 7b26974d5..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/locales/zh/out.gotext.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "language": "zh", - "messages": [ - { - "id": "Hello {From}!", - "message": "Hello {From}!", - "translation": "", - "placeholders": [ - { - "id": "From", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"From\")" - } - ] - }, - { - "id": "Do you like your browser ({User_Agent})?", - "message": "Do you like your browser ({User_Agent})?", - "translation": "", - "placeholders": [ - { - "id": "User_Agent", - "string": "%[1]s", - "type": "string", - "underlyingType": "string", - "argNum": 1, - "expr": "r.Header.Get(\"User-Agent\")" - } - ] - } - ] -} \ No newline at end of file diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go deleted file mode 100644 index b5eb3b334..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/main.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -//go:generate gotext -srclang=en update -out=catalog_gen.go -lang=en,zh - -import ( - "net/http" - - "golang.org/x/text/cmd/gotext/examples/extract_http/pkg" -) - -func main() { - http.Handle("/generize", http.HandlerFunc(pkg.Generize)) -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go b/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go deleted file mode 100644 index 7b4463488..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/extract_http/pkg/pkg.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package pkg - -import ( - "net/http" - - "golang.org/x/text/language" - "golang.org/x/text/message" -) - -var matcher = language.NewMatcher(message.DefaultCatalog.Languages()) - -func Generize(w http.ResponseWriter, r *http.Request) { - lang, _ := r.Cookie("lang") - accept := r.Header.Get("Accept-Language") - tag := message.MatchLanguage(lang.String(), accept) - p := message.NewPrinter(tag) - - p.Fprintf(w, "Hello %s!\n", r.Header.Get("From")) - - p.Fprintf(w, "Do you like your browser (%s)?\n", r.Header.Get("User-Agent")) -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/main.go b/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/main.go deleted file mode 100644 index 2fada451e..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/main.go +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "fmt" - - "golang.org/x/text/language" - "golang.org/x/text/message" -) - -func main() { - var nPizzas = 4 - // The following call gets replaced by a call to the globally - // defined printer. - fmt.Println("We ate", nPizzas, "pizzas.") - - p := message.NewPrinter(language.English) - - // Prevent build failure, although it is okay for gotext. - p.Println(1024) - - // Replaced by a call to p. - fmt.Println("Example punctuation:", "$%^&!") - - { - q := message.NewPrinter(language.French) - - const leaveAnIdentBe = "Don't expand me." - fmt.Print(leaveAnIdentBe) - q.Println() // Prevent build failure, although it is okay for gotext. - } - - fmt.Printf("Hello %s\n", "City") -} diff --git a/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/printer.go b/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/printer.go deleted file mode 100644 index 9ed055620..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/examples/rewrite/printer.go +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build ignore - -package main - -import ( - "golang.org/x/text/language" - "golang.org/x/text/message" -) - -// The printer defined here will be picked up by the first print statement -// in main.go. -var printer = message.NewPrinter(language.English) diff --git a/vendor/golang.org/x/text/cmd/gotext/extract.go b/vendor/golang.org/x/text/cmd/gotext/extract.go deleted file mode 100644 index 103d7e600..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/extract.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "golang.org/x/text/message/pipeline" -) - -// TODO: -// - merge information into existing files -// - handle different file formats (PO, XLIFF) -// - handle features (gender, plural) -// - message rewriting - -func init() { - lang = cmdExtract.Flag.String("lang", "en-US", "comma-separated list of languages to process") -} - -var cmdExtract = &Command{ - Run: runExtract, - UsageLine: "extract *", - Short: "extracts strings to be translated from code", -} - -func runExtract(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - state, err := pipeline.Extract(config) - if err != nil { - return wrap(err, "extract failed") - } - if err := state.Import(); err != nil { - return wrap(err, "import failed") - } - if err := state.Merge(); err != nil { - return wrap(err, "merge failed") - } - return wrap(state.Export(), "export failed") -} diff --git a/vendor/golang.org/x/text/cmd/gotext/generate.go b/vendor/golang.org/x/text/cmd/gotext/generate.go deleted file mode 100644 index 36820df8a..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/generate.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "golang.org/x/text/message/pipeline" -) - -func init() { - out = cmdGenerate.Flag.String("out", "", "output file to write to") -} - -var cmdGenerate = &Command{ - Run: runGenerate, - UsageLine: "generate ", - Short: "generates code to insert translated messages", -} - -func runGenerate(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - s, err := pipeline.Extract(config) - if err != nil { - return wrap(err, "extraction failed") - } - if err := s.Import(); err != nil { - return wrap(err, "import failed") - } - return wrap(s.Generate(), "generation failed") -} diff --git a/vendor/golang.org/x/text/cmd/gotext/main.go b/vendor/golang.org/x/text/cmd/gotext/main.go deleted file mode 100644 index 73f6d91cb..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/main.go +++ /dev/null @@ -1,375 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:generate go build -o gotext.latest -//go:generate ./gotext.latest help gendocumentation -//go:generate rm gotext.latest - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "go/build" - "go/format" - "io" - "io/ioutil" - "log" - "os" - "strings" - "sync" - "text/template" - "unicode" - "unicode/utf8" - - "golang.org/x/text/message/pipeline" - - "golang.org/x/text/language" - "golang.org/x/tools/go/buildutil" -) - -func init() { - flag.Var((*buildutil.TagsFlag)(&build.Default.BuildTags), "tags", buildutil.TagsFlagDoc) -} - -var ( - srcLang = flag.String("srclang", "en-US", "the source-code language") - dir = flag.String("dir", "locales", "default subdirectory to store translation files") -) - -func config() (*pipeline.Config, error) { - tag, err := language.Parse(*srcLang) - if err != nil { - return nil, wrap(err, "invalid srclang") - } - return &pipeline.Config{ - SourceLanguage: tag, - Supported: getLangs(), - TranslationsPattern: `messages\.(.*)\.json`, - GenFile: *out, - }, nil -} - -// NOTE: the Command struct is copied from the go tool in core. - -// A Command is an implementation of a go command -// like go build or go fix. -type Command struct { - // Run runs the command. - // The args are the arguments after the command name. - Run func(cmd *Command, c *pipeline.Config, args []string) error - - // UsageLine is the one-line usage message. - // The first word in the line is taken to be the command name. - UsageLine string - - // Short is the short description shown in the 'go help' output. - Short string - - // Long is the long message shown in the 'go help ' output. - Long string - - // Flag is a set of flags specific to this command. - Flag flag.FlagSet -} - -// Name returns the command's name: the first word in the usage line. -func (c *Command) Name() string { - name := c.UsageLine - i := strings.Index(name, " ") - if i >= 0 { - name = name[:i] - } - return name -} - -func (c *Command) Usage() { - fmt.Fprintf(os.Stderr, "usage: %s\n\n", c.UsageLine) - fmt.Fprintf(os.Stderr, "%s\n", strings.TrimSpace(c.Long)) - os.Exit(2) -} - -// Runnable reports whether the command can be run; otherwise -// it is a documentation pseudo-command such as importpath. -func (c *Command) Runnable() bool { - return c.Run != nil -} - -// Commands lists the available commands and help topics. -// The order here is the order in which they are printed by 'go help'. -var commands = []*Command{ - cmdUpdate, - cmdExtract, - cmdRewrite, - cmdGenerate, - // TODO: - // - update: full-cycle update of extraction, sending, and integration - // - report: report of freshness of translations -} - -var exitStatus = 0 -var exitMu sync.Mutex - -func setExitStatus(n int) { - exitMu.Lock() - if exitStatus < n { - exitStatus = n - } - exitMu.Unlock() -} - -var origEnv []string - -func main() { - flag.Usage = usage - flag.Parse() - log.SetFlags(0) - - args := flag.Args() - if len(args) < 1 { - usage() - } - - if args[0] == "help" { - help(args[1:]) - return - } - - for _, cmd := range commands { - if cmd.Name() == args[0] && cmd.Runnable() { - cmd.Flag.Usage = func() { cmd.Usage() } - cmd.Flag.Parse(args[1:]) - args = cmd.Flag.Args() - config, err := config() - if err != nil { - fatalf("gotext: %+v", err) - } - if err := cmd.Run(cmd, config, args); err != nil { - fatalf("gotext: %+v", err) - } - exit() - return - } - } - - fmt.Fprintf(os.Stderr, "gotext: unknown subcommand %q\nRun 'go help' for usage.\n", args[0]) - setExitStatus(2) - exit() -} - -var usageTemplate = `gotext is a tool for managing text in Go source code. - -Usage: - - gotext command [arguments] - -The commands are: -{{range .}}{{if .Runnable}} - {{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}} - -Use "go help [command]" for more information about a command. - -Additional help topics: -{{range .}}{{if not .Runnable}} - {{.Name | printf "%-11s"}} {{.Short}}{{end}}{{end}} - -Use "gotext help [topic]" for more information about that topic. - -` - -var helpTemplate = `{{if .Runnable}}usage: go {{.UsageLine}} - -{{end}}{{.Long | trim}} -` - -var documentationTemplate = `{{range .}}{{if .Short}}{{.Short | capitalize}} - -{{end}}{{if .Runnable}}Usage: - - go {{.UsageLine}} - -{{end}}{{.Long | trim}} - - -{{end}}` - -// commentWriter writes a Go comment to the underlying io.Writer, -// using line comment form (//). -type commentWriter struct { - W io.Writer - wroteSlashes bool // Wrote "//" at the beginning of the current line. -} - -func (c *commentWriter) Write(p []byte) (int, error) { - var n int - for i, b := range p { - if !c.wroteSlashes { - s := "//" - if b != '\n' { - s = "// " - } - if _, err := io.WriteString(c.W, s); err != nil { - return n, err - } - c.wroteSlashes = true - } - n0, err := c.W.Write(p[i : i+1]) - n += n0 - if err != nil { - return n, err - } - if b == '\n' { - c.wroteSlashes = false - } - } - return len(p), nil -} - -// An errWriter wraps a writer, recording whether a write error occurred. -type errWriter struct { - w io.Writer - err error -} - -func (w *errWriter) Write(b []byte) (int, error) { - n, err := w.w.Write(b) - if err != nil { - w.err = err - } - return n, err -} - -// tmpl executes the given template text on data, writing the result to w. -func tmpl(w io.Writer, text string, data interface{}) { - t := template.New("top") - t.Funcs(template.FuncMap{"trim": strings.TrimSpace, "capitalize": capitalize}) - template.Must(t.Parse(text)) - ew := &errWriter{w: w} - err := t.Execute(ew, data) - if ew.err != nil { - // I/O error writing. Ignore write on closed pipe. - if strings.Contains(ew.err.Error(), "pipe") { - os.Exit(1) - } - fatalf("writing output: %v", ew.err) - } - if err != nil { - panic(err) - } -} - -func capitalize(s string) string { - if s == "" { - return s - } - r, n := utf8.DecodeRuneInString(s) - return string(unicode.ToTitle(r)) + s[n:] -} - -func printUsage(w io.Writer) { - bw := bufio.NewWriter(w) - tmpl(bw, usageTemplate, commands) - bw.Flush() -} - -func usage() { - printUsage(os.Stderr) - os.Exit(2) -} - -// help implements the 'help' command. -func help(args []string) { - if len(args) == 0 { - printUsage(os.Stdout) - // not exit 2: succeeded at 'go help'. - return - } - if len(args) != 1 { - fmt.Fprintf(os.Stderr, "usage: go help command\n\nToo many arguments given.\n") - os.Exit(2) // failed at 'go help' - } - - arg := args[0] - - // 'go help documentation' generates doc.go. - if strings.HasSuffix(arg, "documentation") { - w := &bytes.Buffer{} - - fmt.Fprintln(w, "// Code generated by go generate. DO NOT EDIT.") - fmt.Fprintln(w) - buf := new(bytes.Buffer) - printUsage(buf) - usage := &Command{Long: buf.String()} - tmpl(&commentWriter{W: w}, documentationTemplate, append([]*Command{usage}, commands...)) - fmt.Fprintln(w, "package main") - if arg == "gendocumentation" { - b, err := format.Source(w.Bytes()) - if err != nil { - logf("Could not format generated docs: %v\n", err) - } - if err := ioutil.WriteFile("doc.go", b, 0666); err != nil { - logf("Could not create file alldocs.go: %v\n", err) - } - } else { - fmt.Println(w.String()) - } - return - } - - for _, cmd := range commands { - if cmd.Name() == arg { - tmpl(os.Stdout, helpTemplate, cmd) - // not exit 2: succeeded at 'go help cmd'. - return - } - } - - fmt.Fprintf(os.Stderr, "Unknown help topic %#q. Run 'go help'.\n", arg) - os.Exit(2) // failed at 'go help cmd' -} - -func getLangs() (tags []language.Tag) { - for _, t := range strings.Split(*lang, ",") { - if t == "" { - continue - } - tag, err := language.Parse(t) - if err != nil { - fatalf("gotext: could not parse language %q: %v", t, err) - } - tags = append(tags, tag) - } - return tags -} - -var atexitFuncs []func() - -func atexit(f func()) { - atexitFuncs = append(atexitFuncs, f) -} - -func exit() { - for _, f := range atexitFuncs { - f() - } - os.Exit(exitStatus) -} - -func fatalf(format string, args ...interface{}) { - logf(format, args...) - exit() -} - -func logf(format string, args ...interface{}) { - log.Printf(format, args...) - setExitStatus(1) -} - -func exitIfErrors() { - if exitStatus != 0 { - exit() - } -} diff --git a/vendor/golang.org/x/text/cmd/gotext/rewrite.go b/vendor/golang.org/x/text/cmd/gotext/rewrite.go deleted file mode 100644 index 3ee9555e3..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/rewrite.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "os" - - "golang.org/x/text/message/pipeline" -) - -const printerType = "golang.org/x/text/message.Printer" - -// TODO: -// - merge information into existing files -// - handle different file formats (PO, XLIFF) -// - handle features (gender, plural) -// - message rewriting - -func init() { - overwrite = cmdRewrite.Flag.Bool("w", false, "write files in place") -} - -var ( - overwrite *bool -) - -var cmdRewrite = &Command{ - Run: runRewrite, - UsageLine: "rewrite ", - Short: "rewrites fmt functions to use a message Printer", - Long: ` -rewrite is typically done once for a project. It rewrites all usages of -fmt to use x/text's message package whenever a message.Printer is in scope. -It rewrites Print and Println calls with constant strings to the equivalent -using Printf to allow translators to reorder arguments. -`, -} - -func runRewrite(cmd *Command, _ *pipeline.Config, args []string) error { - w := os.Stdout - if *overwrite { - w = nil - } - pkg := "." - switch len(args) { - case 0: - case 1: - pkg = args[0] - default: - return errorf("can only specify at most one package") - } - return pipeline.Rewrite(w, pkg) -} diff --git a/vendor/golang.org/x/text/cmd/gotext/update.go b/vendor/golang.org/x/text/cmd/gotext/update.go deleted file mode 100644 index 1260750cc..000000000 --- a/vendor/golang.org/x/text/cmd/gotext/update.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package main - -import ( - "golang.org/x/text/message/pipeline" -) - -// TODO: -// - merge information into existing files -// - handle different file formats (PO, XLIFF) -// - handle features (gender, plural) -// - message rewriting - -var ( - lang *string - out *string -) - -func init() { - lang = cmdUpdate.Flag.String("lang", "en-US", "comma-separated list of languages to process") - out = cmdUpdate.Flag.String("out", "", "output file to write to") -} - -var cmdUpdate = &Command{ - Run: runUpdate, - UsageLine: "update * [-out ]", - Short: "merge translations and generate catalog", -} - -func runUpdate(cmd *Command, config *pipeline.Config, args []string) error { - config.Packages = args - state, err := pipeline.Extract(config) - if err != nil { - return wrap(err, "extract failed") - } - if err := state.Import(); err != nil { - return wrap(err, "import failed") - } - if err := state.Merge(); err != nil { - return wrap(err, "merge failed") - } - if err := state.Export(); err != nil { - return wrap(err, "export failed") - } - if *out != "" { - return wrap(state.Generate(), "generation failed") - } - return nil -} -- cgit v1.2.3-1-g7c22