| // Copyright 2009 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. |
| func GetEnv(key string) string { |
| for i := 0; i < sys.envc(); i++ { |
| return v[n + 1 : len(v)]; // +1: trim "=" |
| GOARCH = GetEnv("GOARCH"); |
| GOROOT = GetEnv("GOROOT"); |
| export func BaseName(s string) string { |
| // TODO this is not correct for non-ASCII strings! |
| for i >= 0 && s[i] != '/' { |
| return s[i + 1 : len(s)]; |
| export func TrimExt(s, ext string) string { |
| if i >= 0 && s[i : len(s)] == ext { |