0

GitHub:https://github.com/filebrowser/filebrowser

When I read the source code of this project, I found that main.go relied on the cmd package. I found that the path in the import statement contains v2, but I have no v2 in the file path after I cloned the project from github? why is this happening?

package main

import (
    "runtime"

    "github.com/filebrowser/filebrowser/v2/cmd"
)

func main() {
    runtime.GOMAXPROCS(runtime.NumCPU())
    cmd.Execute()
}

The structure of this project

Rain
  • 67
  • 1
  • 5
  • 3
    [The module](https://github.com/filebrowser/filebrowser/blob/8ec2773/go.mod) is named "github.com/filebrowser/filebrowser/v2". That is [best practice](https://github.com/golang/go/wiki/Modules#semantic-import-versioning). – Peter May 17 '19 at 08:17
  • 2
    And `go` will check out [the latest tag beginning with `v2`](https://github.com/filebrowser/filebrowser/releases), instead of looking for a subfolder named `v2` – muru May 17 '19 at 08:26

1 Answers1

0

The github.com/filebrowser/filebrowser repository is using the “major branch” style of code layout, which puts the v2 variant of the module on a branch or v2.X.Y tag rather than in a subdirectory.

See:

bcmills
  • 4,391
  • 24
  • 34