#Is this part correct? `if errors.As(err

1 messages ยท Page 1 of 1 (latest)

reef kindle
#

No I think right now you'd need to do this check:

if status.Code(err) == codes.NotFound {

since it's coming from the grpc session attachable

#

(Also I think you need that regardless of whether you go with the suggestion I had)

versed arrow
#

@reef kindle thanks. Well in the current code I call exists which I think will return false if the file doesn't exist. So I don't think I need to do special error handling beyond that.

#

(At least I hope so because that's the only reason I call that exists in a separate select in the first place)

#

(separately, it looks like removing the offending error checking code doesn't fix my test failures, I'll keep digging)

#

Maybe I'm not as close to merge as I thought ๐Ÿ˜ญ

reef kindle
#

yeah, thinking about that more it might not work out like that actually ๐Ÿ˜• The problem might be that the error is coming from the Host.directory call since it's a case where the parent directory itself doesn't even exist (nevermind the .env file)

versed arrow
#

Side note, it's hard to get a birds eye view of all the go tests that fail. Like a complete red/green grid

versed arrow
#

If you're ok with it, I'll just drop that particular optimization for now, not because I don't care about it, but just to try to get something merged before I lose my footing and nothing gets merged at all..

#

I already have a growing list of follow-ups

#

(eg. had to drop system variable lookup because Justin has a cache concern)

reef kindle
versed arrow
#

can't pass the --env-file CLI flag because somehow it gets dropped in nested execs and never managed to figure out why

#

etc

versed arrow
#

This one is super weird, seems so random

#

ie - what is it about a module ref with a @ in it, that fails in my PR, even though the test is unrelated to my PR

reef kindle
#

You are hitting the error on Host.directory because the parent dir doesn't exist during dagger init, so you need to check if status.Code(err) == codes.NotFound and consider that the same as "not exists"

#

which is a weird behavior, would obviously be better if the host directory load was even lazier and thus supported chaining a .exists in the way you want, but that's way outta scope

versed arrow
#

So it's the module directory itself that doesn't exist when my code is called via dagger init?

reef kindle
#

not all the test cases are failing though since I think most of them just do dagger init on a dir that already exists (and is empty)

versed arrow
#

ok I see. It's just that that code of mine is called from pretty deep in ModuleSource schema, in places where I would expect the directory to already exist

reef kindle
versed arrow
#

Specifically it's called via LoadUserDefaults, at the very end of localModuleSource, gitModuleSource, directoryAsModuleSource, moduleSourceWithSourceSubpath, moduleSourceWithName, moduleSourceWithSDK

#

Ok I totally missed that situation, where it doesn't exist yet and gets exported at the end

reef kindle
versed arrow
#

testing now

#

Out of curiosity: when doing dagger init in this way, which entrypoint actually creates the ModuleSource? directoryAsModuleSource?

reef kindle
#

dagger init only works for local module sources, so it goes through localModuleSource

#

@versed arrow looks like it's all green, doing another quick review to double check but LGTM if no blockers

versed arrow
#

There's a flake no?