"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "script/build.go" between
gh-cli-1.11.0.tar.gz and gh-cli-1.12.0.tar.gz

About: GitHub CLI is GitHub’s official command line tool.

build.go  (gh-cli-1.11.0):build.go  (gh-cli-1.12.0)
skipping to change at line 26 skipping to change at line 26
// manpages: // manpages:
// Builds the man pages under `share/man/man1/`. // Builds the man pages under `share/man/man1/`.
// //
// clean: // clean:
// Deletes all built files. // Deletes all built files.
// //
package main package main
import ( import (
"errors"
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"time" "time"
skipping to change at line 139 skipping to change at line 140
if sourceDate := os.Getenv("SOURCE_DATE_EPOCH"); sourceDate != "" { if sourceDate := os.Getenv("SOURCE_DATE_EPOCH"); sourceDate != "" {
if sec, err := strconv.ParseInt(sourceDate, 10, 64); err == nil { if sec, err := strconv.ParseInt(sourceDate, 10, 64); err == nil {
t = time.Unix(sec, 0) t = time.Unix(sec, 0)
} }
} }
return t.Format("2006-01-02") return t.Format("2006-01-02")
} }
func sourceFilesLaterThan(t time.Time) bool { func sourceFilesLaterThan(t time.Time) bool {
foundLater := false foundLater := false
_ = filepath.Walk(".", func(path string, info os.FileInfo, err error) err or { err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
if err != nil { if err != nil {
// Ignore errors that occur when the project contains a s
ymlink to a filesystem or volume that
// Windows doesn't have access to.
if path != "." && isAccessDenied(err) {
fmt.Fprintf(os.Stderr, "%s: %v\n", path, err)
return nil
}
return err return err
} }
if foundLater { if foundLater {
return filepath.SkipDir return filepath.SkipDir
} }
if len(path) > 1 && (path[0] == '.' || path[0] == '_') { if len(path) > 1 && (path[0] == '.' || path[0] == '_') {
if info.IsDir() { if info.IsDir() {
return filepath.SkipDir return filepath.SkipDir
} else { } else {
return nil return nil
} }
} }
if info.IsDir() { if info.IsDir() {
if name := filepath.Base(path); name == "vendor" || name
== "node_modules" {
return filepath.SkipDir
}
return nil return nil
} }
if path == "go.mod" || path == "go.sum" || (strings.HasSuffix(pat h, ".go") && !strings.HasSuffix(path, "_test.go")) { if path == "go.mod" || path == "go.sum" || (strings.HasSuffix(pat h, ".go") && !strings.HasSuffix(path, "_test.go")) {
if info.ModTime().After(t) { if info.ModTime().After(t) {
foundLater = true foundLater = true
} }
} }
return nil return nil
}) })
if err != nil {
panic(err)
}
return foundLater return foundLater
} }
func isAccessDenied(err error) bool {
var pe *os.PathError
// we would use `syscall.ERROR_ACCESS_DENIED` if this script supported bu
ild tags
return errors.As(err, &pe) && strings.Contains(pe.Err.Error(), "Access is
denied")
}
func rmrf(targets ...string) error { func rmrf(targets ...string) error {
args := append([]string{"rm", "-rf"}, targets...) args := append([]string{"rm", "-rf"}, targets...)
announce(args...) announce(args...)
for _, target := range targets { for _, target := range targets {
if err := os.RemoveAll(target); err != nil { if err := os.RemoveAll(target); err != nil {
return err return err
} }
} }
return nil return nil
} }
 End of changes. 6 change blocks. 
1 lines changed or deleted 24 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)