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

fallback to pkg root when locating config #78

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

ardnew
Copy link
Contributor

@ardnew ardnew commented Nov 28, 2023

When searching for a config file, only the current working directory is considered.

This change adds a fallback to search the root of the target package when no config file was found.

This allows users to use a single config file at the root of their project to configure all sub-packages, but it does not aggressively go searching for files in any arbitrary parent directory.

Some examples when your working directory is ./cmd/depguard:

.
├── cmd/
│   └── depguard/
│   ├   ├── testfiles/
│   ├   ├── .depguard.yml        # <------ selected
│   ├   ├── depguard*
│   ├   ├── main.go
│   ├   └── main_test.go
│   └   .depguard.yml            # <------ ignored
├── internal/
│   └── utils/
│       ├── .depguard.yml        # <------ ignored
│       ├── errors.go
│       ├── variables.go
│       └── variables_test.go
├── .depguard.yml                # <------ ignored
├── LICENSE
├── README.md
├── depguard.go
├── go.mod
├── go.sum
├── settings.go
└── settings_test.go
.
├── cmd/
│   └── depguard/
│   ├   ├── testfiles/
│   ├   ├── depguard*
│   ├   ├── main.go
│   ├   └── main_test.go
│   └   .depguard.yml            # <------ ignored
├── internal/
│   └── utils/
│       ├── .depguard.yml        # <------ ignored
│       ├── errors.go
│       ├── variables.go
│       └── variables_test.go
├── .depguard.yml                # <------ selected
├── LICENSE
├── README.md
├── depguard.go
├── go.mod
├── go.sum
├── settings.go
└── settings_test.go

cmd/depguard/main.go Show resolved Hide resolved
@dixonwille dixonwille merged commit dffaba4 into OpenPeeDeeP:v2 Dec 1, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants