Skip to content

Build Go projects with Buildpacks #3504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/skaffold/build/buildpacks/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ func (c ArtifactConfig) Path() string {

// validate checks if a file is a valid Buildpack configuration.
func validate(path string) bool {
return filepath.Base(path) == "package.json"
name := filepath.Base(path)

return name == "package.json" || name == "go.mod"
}
9 changes: 7 additions & 2 deletions pkg/skaffold/build/buildpacks/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ func TestValidate(t *testing.T) {
path: "path/to/package.json",
expectedValid: true,
},
{
description: "Go",
path: "path/to/go.mod",
expectedValid: true,
},
{
description: "Unknown language",
path: "path/to/something.txt",
Expand All @@ -59,7 +64,7 @@ func TestDescribe(t *testing.T) {
expectedPrompt string
}{
{
description: "buildpacks",
description: "buildpacks - NodeJS",
config: ArtifactConfig{File: "/path/to/package.json"},
expectedPrompt: "Buildpacks (/path/to/package.json)",
},
Expand All @@ -78,7 +83,7 @@ func TestUpdateArtifact(t *testing.T) {
expectedArtifact latest.Artifact
}{
{
description: "buildpacks",
description: "buildpacks - NodeJS",
config: ArtifactConfig{File: filepath.Join("path", "to", "package.json")},
expectedArtifact: latest.Artifact{
ArtifactType: latest.ArtifactType{BuildpackArtifact: &latest.BuildpackArtifact{
Expand Down