Skip to content
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

Add GetOriginalwd method #224

Merged
merged 1 commit into from
Dec 25, 2022
Merged

Add GetOriginalwd method #224

merged 1 commit into from
Dec 25, 2022

Conversation

wata727
Copy link
Member

@wata727 wata727 commented Dec 21, 2022

Fixes #218
See also terraform-linters/tflint#1612
See also terraform-linters/tflint#1622

This PR adds a new gRPC method called GetOriginalwd(). This method can be called from the Runner and can get the original working directory of the host process (TFLint).

Normally this is equal to os.Getwd(), but differs if --chdir or --recursive is used. If you need the absolute path of the file, joining with the original working directory is appropriate.

$ tree
work
└── sub
    └── main.tf

1 directory, 1 file

$ pwd
/work
$ tflint --chdir=sub
os.Getwd() // => /work/sub
runner.GetOriginalwd() // => /work
runner.GetFile(path).Body.MissingItemRange().Filename // => sub/main.tf

@wata727 wata727 merged commit 1733df8 into master Dec 25, 2022
@wata727 wata727 deleted the get_originalwd branch December 25, 2022 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Question: how to get root module absolute path
1 participant