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

Using tmp dir instead of GOPATH #72

Merged
merged 6 commits into from
Oct 16, 2021

Conversation

rafaelsq
Copy link
Contributor

@rafaelsq rafaelsq commented Oct 14, 2021

No description provided.

@codecov
Copy link

codecov bot commented Oct 14, 2021

Codecov Report

Merging #72 (dd35161) into master (a2dad0a) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #72      +/-   ##
==========================================
+ Coverage   97.00%   97.01%   +0.01%     
==========================================
  Files           8        8              
  Lines         200      201       +1     
==========================================
+ Hits          194      195       +1     
  Misses          4        4              
  Partials        2        2              
Flag Coverage Δ
unittests 97.01% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/fetch.go 88.88% <100.00%> (+0.65%) ⬆️
lib/file.go 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a2dad0a...dd35161. Read the comment docs.

@rafaelsq rafaelsq changed the title Using GOCITY_CACHE instead of GOPATH Using tmp dir instead of GOPATH Oct 14, 2021
@rafaelsq rafaelsq force-pushed the fixGopath branch 2 times, most recently from 2b8ab36 to a6136fa Compare October 14, 2021 19:33
Copy link
Owner

@rodrigo-brito rodrigo-brito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rafaelsq, thank you for the contribution

}
for _, tt := range tests {
t.Run(fmt.Sprintf("given project %s/%s", tt.path, tt.repository), func(t *testing.T) {
got := TrimGoPath(tt.path, tt.repository)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TrimGoPath?, maybe a rename to TrimTemporaryPath will be great

main.go Outdated
Comment on lines 20 to 22
tmpFolder, err := ioutil.TempDir("", "")
if err != nil {
log.Fatal(err)
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, use os.TempDir https://pkg.go.dev/os#TempDir

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not available for the current Go version. I had to fallback to ioutil 😞

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ioutil is deprecated: https://golang.org/doc/go1.16#ioutil

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#73

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated ♻️

"testing"

"github.com/stretchr/testify/assert"
)

func TestFetch(t *testing.T) {
f := NewFetcher()
tmpFolder, _ := ioutil.TempDir("", "")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, change to os.TempDir: https://pkg.go.dev/os#TempDir

@rodrigo-brito rodrigo-brito merged commit e9221fe into rodrigo-brito:master Oct 16, 2021
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.

None yet

2 participants