| 1 |
// Copyright 2015 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 main |
| 6 |
|
| 7 |
import ( |
| 8 |
"fmt" |
| 9 |
"path/filepath" |
| 10 |
) |
| 11 |
|
| 12 |
var cmdClean = &command{ |
| 13 |
run: runClean, |
| 14 |
Name: "clean", |
| 15 |
Usage: "", |
| 16 |
Short: "remove object files and cached gomobile files", |
| 17 |
Long: ` |
| 18 |
Clean removes object files and cached NDK files downloaded by gomobile init |
| 19 |
`, |
| 20 |
} |
| 21 |
|
| 22 |
func runClean(cmd *command) (err error) { |
| 23 |
gopaths := filepath.SplitList(goEnv("GOPATH")) |
| 24 |
if len(gopaths) == 0 { |
| 25 |
return fmt.Errorf("GOPATH is not set") |
| 26 |
} |
| 27 |
gomobilepath = filepath.Join(gopaths[0], "pkg/gomobile") |
| 28 |
if buildX { |
| 29 |
fmt.Fprintln(xout, "GOMOBILE="+gomobilepath) |
| 30 |
} |
| 31 |
return removeAll(gomobilepath) |
| 32 |
} |