Skip to content
  • Chloe Kudryavtsev's avatar
    Add default_cleanup_srcdir · 6a6310f0
    Chloe Kudryavtsev authored and Natanael Copa's avatar Natanael Copa committed
    In some cases, a simple rm -rf is not sufficent to clean srcdir.
    One such case is the new go module system, that marks everything as
    read-only - thus only letting root rm -rf it without a chmod.
    There is a command intended to clean them - `go clean -modcache`.
    However, for that to work, GOPATH must be defined and existent.
    Running chmod for all srcdir cleanups makes no sense, nor does enforcing
    root, or putting global overrides just for go.
    
    This patch allows overriding what happens on `cleanup srcdir`, by
    overriding cleanup_srcdir, and allows the use of default_cleanup_srcdir.
    
    In our go example, it might be used as such:
    
    cleanup_srcdir() {
    	go clean -modcache
    	default_cleanup_srcdir
    }
    6a6310f0