go: malformed module path "function/faas": missing dot in first path element
Vishal1297 opened this issue · 13 comments
I'm new in Knative, and trying to run golang hello kn func example on my local.
After running the build command, I am getting a weird error - go: malformed module path "function/faas": missing dot in first path element
ENV
➜ kn-hello-func git:(main) ✗ kn version
Version: v1.13.0
Build Date: 2024-01-24 16:48:59
Git Revision: 543522a3
Supported APIs:
* Serving
- serving.knative.dev/v1 (knative-serving v1.13.0)
* Eventing
- sources.knative.dev/v1 (knative-eventing v1.13.0)
- eventing.knative.dev/v1 (knative-eventing v1.13.0)
➜ kn-hello-func git:(main) ✗ kn func version
v0.39.0-1-g4b6247d0
func.yaml
specVersion: 0.35.0
name: kn-hello-func
runtime: go
registry: docker.io/ivishalyadav
created: 2024-02-08T11:43:05.053846598+05:30
Logs
➜ kn-hello-func git:(main) ✗ kn func run --build --registry docker.io/ivishalyadav --verbose
Building function image
Pulling image ghcr.io/knative/builder-jammy-tiny:latest
latest: Pulling from knative/builder-jammy-tiny
Digest: sha256:21d4966de6cda91bda7bfcf691ec69f13c3f1ae1bf405e907d042a828bad7228
Status: Image is up to date for ghcr.io/knative/builder-jammy-tiny:latest
Selected run image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
Pulling image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
latest: Pulling from paketobuildpacks/run-jammy-tiny
Digest: sha256:2381406c9e5eebed510ab30350ecd2ef1ec43c38972e091a1493cb114ae9c5f7
Status: Image is up to date for paketobuildpacks/run-jammy-tiny:latest
Creating builder with the following buildpacks:
-> paketo-community/rust@0.35.0
-> paketo-buildpacks/procfile@5.6.4
-> paketo-buildpacks/syft@1.32.1
-> paketo-community/cargo@0.10.1
-> paketo-community/rust-dist@1.19.0
-> paketo-community/rustup@1.9.1
-> dev.knative-extensions.go@0.0.6
-> paketo-buildpacks/go@4.7.0
-> paketo-buildpacks/ca-certificates@3.6.7
-> paketo-buildpacks/environment-variables@4.5.6
-> paketo-buildpacks/git@1.0.8
-> paketo-buildpacks/go-build@2.2.0
-> paketo-buildpacks/go-dist@2.4.5
-> paketo-buildpacks/go-mod-vendor@1.0.28
-> paketo-buildpacks/image-labels@4.5.5
-> paketo-buildpacks/procfile@5.6.8
-> paketo-buildpacks/watchexec@2.8.7
-> paketo-buildpacks/java-native-image@8.26.0
-> paketo-buildpacks/bellsoft-liberica@10.4.5
-> paketo-buildpacks/ca-certificates@3.6.7
-> paketo-buildpacks/datadog@4.8.0
-> paketo-buildpacks/environment-variables@4.5.6
-> paketo-buildpacks/executable-jar@6.8.3
-> paketo-buildpacks/gradle@7.7.1
-> paketo-buildpacks/image-labels@4.5.5
-> paketo-buildpacks/leiningen@4.6.9
-> paketo-buildpacks/maven@6.15.12
-> paketo-buildpacks/native-image@5.12.7
-> paketo-buildpacks/procfile@5.6.8
-> paketo-buildpacks/quarkus@0.2.4
-> paketo-buildpacks/sbt@6.12.11
-> paketo-buildpacks/spring-boot@5.27.8
-> paketo-buildpacks/syft@1.42.0
-> paketo-buildpacks/upx@3.4.7
-> paketo-buildpacks/java@11.0.0
-> paketo-buildpacks/apache-tomcat@7.14.3
-> paketo-buildpacks/apache-tomee@1.8.0
-> paketo-buildpacks/azure-application-insights@5.17.3
-> paketo-buildpacks/bellsoft-liberica@10.5.2
-> paketo-buildpacks/ca-certificates@3.6.7
-> paketo-buildpacks/clojure-tools@2.8.14
-> paketo-buildpacks/datadog@5.1.0
-> paketo-buildpacks/dist-zip@5.6.8
-> paketo-buildpacks/encrypt-at-rest@4.5.13
-> paketo-buildpacks/environment-variables@4.5.6
-> paketo-buildpacks/executable-jar@6.8.3
-> paketo-buildpacks/google-stackdriver@8.0.4
-> paketo-buildpacks/gradle@7.7.1
-> paketo-buildpacks/image-labels@4.5.5
-> paketo-buildpacks/jattach@1.5.0
-> paketo-buildpacks/java-memory-assistant@1.4.9
-> paketo-buildpacks/leiningen@4.6.9
-> paketo-buildpacks/liberty@4.0.0
-> paketo-buildpacks/maven@6.15.12
-> paketo-buildpacks/node-engine@3.2.0
-> paketo-buildpacks/procfile@5.6.8
-> paketo-buildpacks/quarkus@0.2.4
-> paketo-buildpacks/sbt@6.12.11
-> paketo-buildpacks/spring-boot@5.27.8
-> paketo-buildpacks/syft@1.42.0
-> paketo-buildpacks/watchexec@2.8.7
-> paketo-buildpacks/yarn@1.3.0
-> paketo-buildpacks/procfile@5.6.8
Using build cache volume pack-cache-ivishalyadav_kn-hello-func_latest-f2dfafb0a74c.build
Running the creator on OS linux with:
Container Settings:
Args: /cnb/lifecycle/creator -daemon -launch-cache /launch-cache -log-level debug -app /workspace -cache-dir /cache -run-image index.docker.io/paketobuildpacks/run-jammy-tiny:latest -gid 0 index.docker.io/ivishalyadav/kn-hello-func:latest
System Envs: CNB_PLATFORM_API=0.12
Image: pack.local/builder/68637771726376636c79:latest
User: root
Labels: map[author:pack]
Host Settings:
Binds: pack-cache-ivishalyadav_kn-hello-func_latest-f2dfafb0a74c.build:/cache /var/run/docker.sock:/var/run/docker.sock pack-cache-ivishalyadav_kn-hello-func_latest-f2dfafb0a74c.launch:/launch-cache pack-layers-ufrumcxuxo:/layers pack-app-ojbqdmsbyc:/workspace
Network Mode: host
Starting creator...
Parsing inputs...
Ensuring privileges...
Executing command...
===> ANALYZING
Timer: Analyzer started at 2024-02-09T07:22:16Z
Found image with identifier "454e51cec4a97ed3b7afb80ad108a0f96790f0da38d23d6885702e491e5b3902"
Found image with identifier "36643d2c344602e38bc4dc2aa0b06d98cf1a5509abc828c7e41eb6ca1dc8526a"
Timer: Analyzer ran for 70.425µs and ended at 2024-02-09T07:22:16Z
Run image info in analyzed metadata is:
{"Reference":"36643d2c344602e38bc4dc2aa0b06d98cf1a5509abc828c7e41eb6ca1dc8526a","Image":"index.docker.io/paketobuildpacks/run-jammy-tiny:latest","Extend":false,"target":{"os":"linux","arch":"amd64"}}
===> DETECTING
Timer: Detector started at 2024-02-09T07:22:16Z
Checking for match against descriptor: {linux amd64 [{ubuntu 18.04}]}
======== Output: paketo-buildpacks/procfile@5.6.4 ========
SKIPPED: No procfile found from either source path or binding.
======== Results ========
pass: paketo-community/rustup@1.9.1
pass: paketo-community/rust-dist@1.19.0
pass: paketo-buildpacks/syft@1.32.1
fail: paketo-community/cargo@0.10.1
skip: paketo-buildpacks/procfile@5.6.4
======== Results ========
pass: paketo-buildpacks/go-dist@2.4.5
pass: dev.knative-extensions.go@0.0.6
Resolving plan... (try #1)
paketo-buildpacks/go-dist 2.4.5
dev.knative-extensions.go 0.0.6
Timer: Detector ran for 34.128778ms and ended at 2024-02-09T07:22:16Z
===> RESTORING
Timer: Restorer started at 2024-02-09T07:22:16Z
Restoring Layer Metadata
Reading buildpack directory: /layers/paketo-buildpacks_go-dist
Reading buildpack directory: /layers/dev.knative-extensions.go
Reading Buildpack Layers directory /layers
Reading buildpack directory: /layers/paketo-buildpacks_go-dist
Reading Buildpack Layers directory /layers
Reading buildpack directory: /layers/dev.knative-extensions.go
Timer: Restorer ran for 206.009µs and ended at 2024-02-09T07:22:16Z
===> BUILDING
Timer: Builder started at 2024-02-09T07:22:16Z
Running build for buildpack paketo-buildpacks/go-dist@2.4.5
Looking up buildpack
Finding plan
Creating plan directory
Preparing paths
Running build command
Paketo Buildpack for Go Distribution 2.4.5
Resolving Go version
Candidate version sources (in priority order):
<unknown> -> ""
Selected Go version (using <unknown>): 1.20.14
Executing build process
Installing Go 1.20.14
Completed in 20.297s
Generating SBOM for /layers/paketo-buildpacks_go-dist/go
Completed in 23ms
Processing layers
Updating environment
Reading output files
Updating buildpack processes
Updating process list
Finished running build for buildpack paketo-buildpacks/go-dist@2.4.5
Running build for buildpack dev.knative-extensions.go@0.0.6
Looking up buildpack
Finding plan
Creating plan directory
Preparing paths
Running build command
> Knative Functions Go Buildpack
Fetching framework dependencies
go: malformed module path "function/faas": missing dot in first path element
Timer: Builder ran for 20.357803646s and ended at 2024-02-09T07:22:37Z
ERROR: failed to build: exit status 1
Error: executing lifecycle: failed with status code: 51
Error: exit status 1
@lkingland Can i look into this?
I forgot to mention that this is happening in WSL.
@lkingland Can i look into this?
Yes, please. I see Matej already set you as assignee 👍
-
After digging into this, I discovered that functions were initially referred to as "faas" in the Knative Func repository. However, everything was later renamed to "function" after pull request #210.
-
According to the error, the build process is attempting to execute code that requires a module named "function/faas". However, this path is missing a domain name and appears to be a source directory.
I'm not sure if there's any connection between these two points, but I couldn't find any explicit mention of the "function/faas" module in the Func repository.
Can someone elaborate over this?
@Sanket-0510 can you at least reproduce this issue? I do not recall running into this on Linux.
@matejvasek I am on linux, I tried reproducing this error but on my side the function was build successfully, no such error. @Vishal1297 can you verify this again, are you still facing this issue?
@matejvasek I am on linux, I tried reproducing this error but on my side the function was build successfully, no such error. @Vishal1297 can you verify this again, are you still facing this issue?
I faced this issue only once and I got error after doing a change in go module name (github.com/Vishal1297/function)
Hi @Vishal1297 @Sanket-0510 , I ran into the same error today. Is it solved? I tried latest func from main, but still got same issue.
kn version
Version: v1.13.0
Build Date: 2024-01-24 16:48:59
Git Revision: 543522a3
Supported APIs:
* Serving
- serving.knative.dev/v1 (knative-serving v1.13.0)
* Eventing
- sources.knative.dev/v1 (knative-eventing v1.13.0)
- eventing.knative.dev/v1 (knative-eventing v1.13.0)
func version
v0.40.0-57-g8f3f718a
go version
go version go1.22.0 linux/amd64
Logs:
➜ bing-search-tool git:(master) func run
Building function image
Still building
Still building
Yes, still building
Don't give up on me
2024/03/15 18:15:11.835122 DEBUG: Pulling image ghcr.io/knative/builder-jammy-tiny:latest
latest: Pulling from knative/builder-jammy-tiny
Digest: sha256:1cb6a617b2f290cbc9ca1cb9c2c0504b896ddce88b8351aa4d8d71f0ba3551eb
Status: Image is up to date for ghcr.io/knative/builder-jammy-tiny:latest
2024/03/15 18:15:15.649143 DEBUG: CheckReadAccess succeeded for the run image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
2024/03/15 18:15:15.649157 DEBUG: Selected run image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
2024/03/15 18:15:15.649167 DEBUG: Pulling image index.docker.io/paketobuildpacks/run-jammy-tiny:latest
latest: Pulling from paketobuildpacks/run-jammy-tiny
Digest: sha256:8972e2b07e13266bd51d04289e2454f8ab50d94d0a8b2bc6ea705931ddf5fe85
Status: Image is up to date for paketobuildpacks/run-jammy-tiny:latest
2024/03/15 18:15:17.994305 DEBUG: Creating builder with the following buildpacks:
2024/03/15 18:15:17.994311 DEBUG: -> paketo-community/rust@0.35.0
2024/03/15 18:15:17.994311 DEBUG: -> paketo-buildpacks/procfile@5.6.4
2024/03/15 18:15:17.994312 DEBUG: -> paketo-buildpacks/syft@1.32.1
2024/03/15 18:15:17.994313 DEBUG: -> paketo-community/cargo@0.10.1
2024/03/15 18:15:17.994313 DEBUG: -> paketo-community/rust-dist@1.19.0
2024/03/15 18:15:17.994314 DEBUG: -> paketo-community/rustup@1.9.1
2024/03/15 18:15:17.994315 DEBUG: -> dev.knative-extensions.go@0.0.6
2024/03/15 18:15:17.994315 DEBUG: -> paketo-buildpacks/go@4.8.0
2024/03/15 18:15:17.994316 DEBUG: -> paketo-buildpacks/ca-certificates@3.6.8
2024/03/15 18:15:17.994317 DEBUG: -> paketo-buildpacks/environment-variables@4.5.7
2024/03/15 18:15:17.994317 DEBUG: -> paketo-buildpacks/git@1.0.8
2024/03/15 18:15:17.994320 DEBUG: -> paketo-buildpacks/go-build@2.2.1
2024/03/15 18:15:17.994321 DEBUG: -> paketo-buildpacks/go-dist@2.5.0
2024/03/15 18:15:17.994322 DEBUG: -> paketo-buildpacks/go-mod-vendor@1.0.29
2024/03/15 18:15:17.994322 DEBUG: -> paketo-buildpacks/image-labels@4.5.6
2024/03/15 18:15:17.994323 DEBUG: -> paketo-buildpacks/procfile@5.6.9
2024/03/15 18:15:17.994323 DEBUG: -> paketo-buildpacks/watchexec@2.9.0
2024/03/15 18:15:17.994324 DEBUG: -> paketo-buildpacks/java-native-image@9.0.0
2024/03/15 18:15:17.994325 DEBUG: -> paketo-buildpacks/bellsoft-liberica@10.5.3
2024/03/15 18:15:17.994326 DEBUG: -> paketo-buildpacks/ca-certificates@3.6.8
2024/03/15 18:15:17.994326 DEBUG: -> paketo-buildpacks/datadog@5.4.0
2024/03/15 18:15:17.994327 DEBUG: -> paketo-buildpacks/environment-variables@4.5.7
2024/03/15 18:15:17.994327 DEBUG: -> paketo-buildpacks/executable-jar@6.8.4
2024/03/15 18:15:17.994331 DEBUG: -> paketo-buildpacks/gradle@7.8.1
2024/03/15 18:15:17.994332 DEBUG: -> paketo-buildpacks/image-labels@4.5.6
2024/03/15 18:15:17.994332 DEBUG: -> paketo-buildpacks/leiningen@4.7.0
2024/03/15 18:15:17.994333 DEBUG: -> paketo-buildpacks/maven@6.15.13
2024/03/15 18:15:17.994334 DEBUG: -> paketo-buildpacks/native-image@5.12.8
2024/03/15 18:15:17.994334 DEBUG: -> paketo-buildpacks/procfile@5.6.9
2024/03/15 18:15:17.994335 DEBUG: -> paketo-buildpacks/quarkus@0.2.5
2024/03/15 18:15:17.994336 DEBUG: -> paketo-buildpacks/sbt@6.12.12
2024/03/15 18:15:17.994336 DEBUG: -> paketo-buildpacks/spring-boot@5.27.10
2024/03/15 18:15:17.994337 DEBUG: -> paketo-buildpacks/syft@1.45.0
2024/03/15 18:15:17.994337 DEBUG: -> paketo-buildpacks/upx@3.4.8
2024/03/15 18:15:17.994338 DEBUG: -> paketo-buildpacks/java@12.0.0
2024/03/15 18:15:17.994339 DEBUG: -> paketo-buildpacks/apache-tomcat@7.15.0
2024/03/15 18:15:17.994339 DEBUG: -> paketo-buildpacks/apache-tomee@1.8.1
2024/03/15 18:15:17.994340 DEBUG: -> paketo-buildpacks/azure-application-insights@5.17.4
2024/03/15 18:15:17.994341 DEBUG: -> paketo-buildpacks/bellsoft-liberica@10.5.3
2024/03/15 18:15:17.994345 DEBUG: -> paketo-buildpacks/ca-certificates@3.6.8
2024/03/15 18:15:17.994346 DEBUG: -> paketo-buildpacks/clojure-tools@2.8.15
2024/03/15 18:15:17.994347 DEBUG: -> paketo-buildpacks/datadog@5.4.0
2024/03/15 18:15:17.994347 DEBUG: -> paketo-buildpacks/dist-zip@5.6.9
2024/03/15 18:15:17.994348 DEBUG: -> paketo-buildpacks/encrypt-at-rest@4.5.15
2024/03/15 18:15:17.994349 DEBUG: -> paketo-buildpacks/environment-variables@4.5.7
2024/03/15 18:15:17.994349 DEBUG: -> paketo-buildpacks/executable-jar@6.8.4
2024/03/15 18:15:17.994350 DEBUG: -> paketo-buildpacks/google-stackdriver@9.0.0
2024/03/15 18:15:17.994351 DEBUG: -> paketo-buildpacks/gradle@7.8.1
2024/03/15 18:15:17.994351 DEBUG: -> paketo-buildpacks/image-labels@4.5.6
2024/03/15 18:15:17.994352 DEBUG: -> paketo-buildpacks/jattach@1.6.0
2024/03/15 18:15:17.994353 DEBUG: -> paketo-buildpacks/java-memory-assistant@1.4.10
2024/03/15 18:15:17.994353 DEBUG: -> paketo-buildpacks/leiningen@4.7.0
2024/03/15 18:15:17.994354 DEBUG: -> paketo-buildpacks/liberty@4.0.1
2024/03/15 18:15:17.994354 DEBUG: -> paketo-buildpacks/maven@6.15.13
2024/03/15 18:15:17.994355 DEBUG: -> paketo-buildpacks/node-engine@3.2.2
2024/03/15 18:15:17.994356 DEBUG: -> paketo-buildpacks/procfile@5.6.9
2024/03/15 18:15:17.994357 DEBUG: -> paketo-buildpacks/quarkus@0.2.5
2024/03/15 18:15:17.994358 DEBUG: -> paketo-buildpacks/sbt@6.12.12
2024/03/15 18:15:17.994358 DEBUG: -> paketo-buildpacks/spring-boot@5.27.10
2024/03/15 18:15:17.994359 DEBUG: -> paketo-buildpacks/syft@1.45.0
2024/03/15 18:15:17.994360 DEBUG: -> paketo-buildpacks/watchexec@2.9.0
2024/03/15 18:15:17.994360 DEBUG: -> paketo-buildpacks/yarn@1.3.2
2024/03/15 18:15:17.994361 DEBUG: -> paketo-buildpacks/procfile@5.6.9
2024/03/15 18:15:18.233208 DEBUG: Using build cache volume pack-cache-bing-search-tool_bing-search-tool_latest-0028ace14382.build
2024/03/15 18:15:18.233240 DEBUG: Running the creator on OS linux from image pack.local/builder/6468686d71796a6e7277:latest with:
2024/03/15 18:15:18.233241 DEBUG: Container Settings:
2024/03/15 18:15:18.233243 DEBUG: Args: /cnb/lifecycle/creator -daemon -launch-cache /launch-cache -app /workspace -cache-dir /cache -run-image index.docker.io/paketobuildpacks/run-jammy-tiny:latest -gid 0 -uid 0 localhost:5000/bing-search-tool/bing-search-tool:latest
2024/03/15 18:15:18.233244 DEBUG: System Envs: CNB_PLATFORM_API=0.12
2024/03/15 18:15:18.233245 DEBUG: Image: pack.local/builder/6468686d71796a6e7277:latest
2024/03/15 18:15:18.233246 DEBUG: User: root
2024/03/15 18:15:18.233250 DEBUG: Labels: map[author:pack]
2024/03/15 18:15:18.233251 DEBUG: Host Settings:
2024/03/15 18:15:18.233252 DEBUG: Binds: pack-cache-bing-search-tool_bing-search-tool_latest-0028ace14382.build:/cache /var/run/docker.sock:/var/run/docker.sock pack-cache-bing-search-tool_bing-search-tool_latest-0028ace14382.launch:/launch-cache pack-layers-hpxfrmbgax:/layers pack-app-exoodiquvg:/workspace
2024/03/15 18:15:18.233253 DEBUG: Network Mode: host
===> ANALYZING
Restoring data for SBOM from previous image
===> DETECTING
paketo-buildpacks/go-dist 2.5.0
dev.knative-extensions.go 0.0.6
===> RESTORING
Restoring metadata for "paketo-buildpacks/go-dist:go" from cache
Restoring metadata for "dev.knative-extensions.go:app" from app image
Restoring data for "paketo-buildpacks/go-dist:go" from cache
Restoring data for SBOM from cache
===> BUILDING
Paketo Buildpack for Go Distribution 2.5.0
Resolving Go version
Candidate version sources (in priority order):
<unknown> -> ""
Selected Go version (using <unknown>): 1.21.7
Executing build process
Installing Go 1.21.7
Completed in 38.742s
Generating SBOM for /layers/paketo-buildpacks_go-dist/go
Completed in 0s
> Knative Functions Go Buildpack
Fetching framework dependencies
go: malformed module path "function/faas": missing dot in first path element
ERROR: failed to build: exit status 1
Error: failed to build the function: executing lifecycle: failed with status code: 51
Also forget to mention that I'm running on Linux too, with :
bing-search-tool git:(master) lsb_release -a
No LSB modules are available.
Distributor ID: Linuxmint
Description: Linux Mint 21.3
Release: 21.3
Codename: virginia
➜ bing-search-tool git:(master) docker version
Client: Docker Engine - Community
Version: 25.0.3
API version: 1.44
Go version: go1.21.6
Git commit: 4debf41
Built: Tue Feb 6 21:13:09 2024
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 25.0.3
API version: 1.44 (minimum version 1.24)
Go version: go1.21.6
Git commit: f417435
Built: Tue Feb 6 21:13:09 2024
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.28
GitCommit: ae07eda36dd25f8a1b98dfbf587313b99c0190bb
runc:
Version: 1.1.12
GitCommit: v1.1.12-0-g51d5e94
docker-init:
Version: 0.19.0
GitCommit: de40ad0
Hi @drriguz,
For me I modified module name in go.mod file.
Try deleting the go.mod & go.sum file.
Run following commands
go mod init function
go mod tidy
module function
go 1.21.4
@Vishal1297 I think I find the cause: it must be module function
in go.mod, if you change it to any other module name, you got this error. However, it seems to be a bug.
@Sanket-0510 could you look at it again?