forked from elastic/package-storage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmagefile.go
63 lines (50 loc) · 1.07 KB
/
magefile.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
// or more contributor license agreements. Licensed under the Elastic License;
// you may not use this file except in compliance with the Elastic License.
// +build mage
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/magefile/mage/sh"
)
var (
buildDir = "./build"
publicDir = filepath.Join(buildDir, "public")
packagePaths = []string{"./packages"}
)
func Build() error {
return nil
}
func Check() error {
err := Build()
if err != nil {
return err
}
err = Vendor()
if err != nil {
return err
}
// Check if no changes are shown
err = sh.RunV("git", "update-index", "--refresh")
if err != nil {
return err
}
return sh.RunV("git", "diff-index", "--exit-code", "HEAD", "--")
}
func Clean() error {
return os.RemoveAll(buildDir)
}
func Vendor() error {
fmt.Println(">> mod - updating vendor directory")
err := sh.RunV("go", "mod", "vendor")
if err != nil {
return err
}
err = sh.RunV("go", "mod", "verify")
if err != nil {
return err
}
return nil
}