Skip to content

Commit

Permalink
fix: support get the metadata from a git subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed May 30, 2021
1 parent 7f20a45 commit e6e7dd1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions project.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,18 @@ func projectFromPath(path string) (*project, error) {
// metadata
{
// guess it
if u.FileExists(filepath.Join(project.Git.Root, "Dockerfile")) {
if u.FileExists(filepath.Join(project.Path, "Dockerfile")) { // FIXME: look for other dockerfiles
project.Git.Metadata.HasDocker = u.BoolPtr(true)
project.Git.Metadata.HasBinary = u.BoolPtr(true)
} else {
project.Git.Metadata.HasDocker = u.BoolPtr(false)
if u.FileExists(filepath.Join(project.Path, "main.go")) { // FIXME: improve check
project.Git.Metadata.HasBinary = u.BoolPtr(true)
} else {
project.Git.Metadata.HasBinary = u.BoolPtr(false)
}
}
goFiles, err := filepath.Glob(filepath.Join(project.Git.Root, "*.go"))
goFiles, err := filepath.Glob(filepath.Join(project.Path, "*.go")) // FIXME: recursive
if err != nil {
return nil, fmt.Errorf("glob: %w", err)
}
Expand Down

0 comments on commit e6e7dd1

Please sign in to comment.