You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Incorrect/confusing include cycle detected error message after a silly mistake #1881
# TaskfileCommon.ymlversion: '3'includes: # This was the silly mistake, this should be `vars` not `includes`GOBIN:
sh: echo $(go env GOPATH)/bintasks:
test:
cmds:
- "{{.GOBIN}}/richgo test ./..."
Then I tried running:
task common:test
And the error message I got back was this:
task: include cycle detected between /Users/vingarcia/temp/tfile/Taskfile.yml <--> /Users/vingarcia/temp/tfile/TaskfileCommon.yml
I am not sure how easy it is to fix this issue and I understand this might not be a high priority bug, but I thought it would be worth mentioning anyway.
Great tool, thanks for making it and keeping it open source =]
Hi @VinGarcia , You’re getting a cyclic include error because it implicitly re-points to the default Taskfile.yml file.
In TaskfileCommon.yml, the GOBIN field is missing the path (taskfile) field, so it defaults to an empty string, which points only to the current directory (joining dir and path with path being empty). As a result, when the code tries to locate the actual file using the Exists function, it doesn't find the actual file and then checks for default filenames—in this case, Taskfile.yml.
I'm not sure if this is an issue that needs to be fixed, but perhaps we could consider preventing empty strings and null values in the path of includes if there’s no use case for them.
Activity
semihbkgr commentedon Nov 1, 2024
Hi @VinGarcia , You’re getting a
cyclic includeerror because it implicitly re-points to the defaultTaskfile.ymlfile.In
TaskfileCommon.yml, theGOBINfield is missing thepath(taskfile) field, so it defaults to an empty string, which points only to the current directory (joiningdirandpathwithpathbeing empty). As a result, when the code tries to locate the actual file using theExistsfunction, it doesn't find the actual file and then checks for default filenames—in this case, Taskfile.yml.task/taskfile/taskfile.go
Lines 105 to 126 in fe09c01
The view of the
include cycleis:graph LR; Taskfile.yml-->|common|TaskfileCommon.yml; TaskfileCommon.yml-->|GOBIN|Taskfile.yml;semihbkgr commentedon Nov 1, 2024
I'm not sure if this is an issue that needs to be fixed, but perhaps we could consider preventing empty strings and null values in the path of includes if there’s no use case for them.
pd93 commentedon Nov 1, 2024
This should absolutely be generating an error when no
taskfile:ordirectory:is specified on an include.semihbkgr commentedon Nov 1, 2024
@pd93 So, I think I can work on this.