├── v3 ├── go.mod ├── go.sum └── quote.go ├── go.mod ├── README.md ├── buggy └── buggy_test.go ├── go.sum ├── quote.go ├── quote_test.go └── LICENSE /v3/go.mod: -------------------------------------------------------------------------------- 1 | module rsc.io/quote/v3 2 | 3 | require rsc.io/sampler v1.3.0 4 | 5 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module rsc.io/quote 2 | 3 | require ( 4 | rsc.io/quote/v3 v3.0.0 5 | rsc.io/sampler v1.3.0 6 | ) 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | This package collects pithy sayings. 2 | 3 | It's part of a demonstration of 4 | [package versioning in Go](https://research.swtch.com/vgo1). 5 | -------------------------------------------------------------------------------- /buggy/buggy_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | 5 | package buggy 6 | 7 | import "testing" 8 | 9 | func Test(t *testing.T) { 10 | t.Fatal("buggy!") 11 | } 12 | -------------------------------------------------------------------------------- /v3/go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8= 2 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 3 | rsc.io/sampler v1.99.99 h1:7i08f/p5TBU5joCPW3GjWG1ZFCmr28ybGqlXtelhEK8= 4 | rsc.io/sampler v1.99.99/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= 5 | -------------------------------------------------------------------------------- /v3/quote.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | 5 | // Package quote collects pithy sayings. 6 | package quote // import "rsc.io/quote" 7 | 8 | import "rsc.io/sampler" 9 | 10 | // Hello returns a greeting. 11 | func HelloV3() string { 12 | return sampler.Hello() 13 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c h1:qgOY6WgZOaTkIIMiVjBQcw93ERBE4m30iBm00nkL0i8= 2 | golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 3 | rsc.io/quote/v2 v2.0.1 h1:DF8hmGbDhgiIa2tpqLjHLIKkJx6WjCtLEqZBAU+hACI= 4 | rsc.io/quote/v2 v2.0.1/go.mod h1:EgjyEkPoRlzZbvGiUV/6yo8qd6yeDd/CP/9lRtfg4PU= 5 | rsc.io/sampler v1.3.0 h1:7uVkIFmeBqHfdjD+gZwtXXI+RODJ2Wc4O7MPEh/QiW4= 6 | rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= 7 | -------------------------------------------------------------------------------- /quote.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | 5 | // Package quote collects pithy sayings. 6 | package quote // import "rsc.io/quote" 7 | 8 | import "rsc.io/quote/v3" 9 | 10 | // Hello returns a greeting. 11 | func Hello() string { 12 | return quote.HelloV3() 13 | } 14 | 15 | // Glass returns a useful phrase for world travelers. 16 | func Glass() string { 17 | // See http://www.oocities.org/nodotus/hbglass.html. 18 | return quote.GlassV3() 19 | } 20 | 21 | // Go returns a Go proverb. 22 | func Go() string { 23 | return quote.GoV3() 24 | } 25 | 26 | // Opt returns an optimization truth. 27 | func Opt() string { 28 | // Wisdom from ken. 29 | return quote.OptV3() 30 | } 31 | -------------------------------------------------------------------------------- /quote_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2018 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 | 5 | package quote 6 | 7 | import ( 8 | "os" 9 | "testing" 10 | ) 11 | 12 | func init() { 13 | os.Setenv("LC_ALL", "en") 14 | } 15 | 16 | func TestHello(t *testing.T) { 17 | hello := "Hello, world." 18 | if out := Hello(); out != hello { 19 | t.Errorf("Hello() = %q, want %q", out, hello) 20 | } 21 | } 22 | 23 | func TestGlass(t *testing.T) { 24 | glass := "I can eat glass and it doesn't hurt me." 25 | if out := Glass(); out != glass { 26 | t.Errorf("Glass() = %q, want %q", out, glass) 27 | } 28 | } 29 | 30 | func TestGo(t *testing.T) { 31 | go1 := "Don't communicate by sharing memory, share memory by communicating." 32 | if out := Go(); out != go1 { 33 | t.Errorf("Go() = %q, want %q", out, go1) 34 | } 35 | } 36 | 37 | func TestOpt(t *testing.T) { 38 | opt := "If a program is too slow, it must have a loop." 39 | if out := Opt(); out != opt { 40 | t.Errorf("Opt() = %q, want %q", out, opt) 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009 The Go Authors. All rights reserved. 2 | 3 | Redistribution and use in source and binary forms, with or without 4 | modification, are permitted provided that the following conditions are 5 | met: 6 | 7 | * Redistributions of source code must retain the above copyright 8 | notice, this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above 10 | copyright notice, this list of conditions and the following disclaimer 11 | in the documentation and/or other materials provided with the 12 | distribution. 13 | * Neither the name of Google Inc. nor the names of its 14 | contributors may be used to endorse or promote products derived from 15 | this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | --------------------------------------------------------------------------------