google / google/addlicense

Intermittent failure

Open
#114 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
886
Forks
194
PR merge metrics
No merged PRs in 30d

Description

On some runs, freuqnetly enough, this completely erases the existing code, and replaces it with license text.

My guess is that there's perhaps a race condition somewhere in the code.

To replicate this, the following works for me -

1. I invoke it like below (on a repo with just about 15 files) -

```
find | xargs ~/go/bin/addlicense
```

I have about 15 files.

There's a good chance that this erases one of my files with just the license. If it didn't -

2. Git reset to remove the lincense again -

```
git reset --hard
```

And go to step 1 until you see this happening.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with `find | xargs ~/go/bin/addlicense` against a repository containing about 15 files, repeating after `git reset --hard` as described. Trace the addlicense entry point and file-processing behavior during repeated xargs runs, then verify that existing source is never replaced by license text.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.