pathutil.go 371 B

123456789101112131415
  1. // Copyright 2020 The Gogs Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package pathutil
  5. import (
  6. "path"
  7. "strings"
  8. )
  9. // Clean cleans up given path and returns a relative path that goes straight down.
  10. func Clean(p string) string {
  11. return strings.Trim(path.Clean("/"+p), "/")
  12. }