~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to test/env.go

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-04-20 17:36:48 UTC
  • Revision ID: james.westby@ubuntu.com-20110420173648-ifergoxyrm832trd
Tags: upstream-2011.03.07.1
Import upstream version 2011.03.07.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// $G $F.go && $L $F.$A && ./$A.out
 
2
 
 
3
// Copyright 2009 The Go Authors. All rights reserved.
 
4
// Use of this source code is governed by a BSD-style
 
5
// license that can be found in the LICENSE file.
 
6
 
 
7
package main
 
8
 
 
9
import os "os"
 
10
 
 
11
func main() {
 
12
        ga, e0 := os.Getenverror("GOARCH")
 
13
        if e0 != nil {
 
14
                print("$GOARCH: ", e0.String(), "\n")
 
15
                os.Exit(1)
 
16
        }
 
17
        if ga != "amd64" && ga != "386" && ga != "arm" {
 
18
                print("$GOARCH=", ga, "\n")
 
19
                os.Exit(1)
 
20
        }
 
21
        xxx, e1 := os.Getenverror("DOES_NOT_EXIST")
 
22
        if e1 != os.ENOENV {
 
23
                print("$DOES_NOT_EXIST=", xxx, "; err = ", e1.String(), "\n")
 
24
                os.Exit(1)
 
25
        }
 
26
}