-
Notifications
You must be signed in to change notification settings - Fork 646
Conversation
@ramya-rao-a please check |
src/goSuggest.ts
Outdated
} | ||
|
||
if (goFilename.endsWith('internal_test.go')) { | ||
return resolve(basename(dirname(filename))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you point me to any docs that talk about this as a standard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are practice to make a test package to test un-exported method when necessary.
No official docs but here:
- https://medium.com/@matryer/5-simple-tips-and-tricks-for-writing-unit-tests-in-golang-619653f90742
- https://blog.alexellis.io/golang-writing-unit-tests/
Hmm.. I found not too much:
$ find /usr/local/Cellar/go/1.9/libexec/src | grep internal_test.go
/usr/local/Cellar/go/1.9/libexec/src/net/http/transport_internal_test.go
/usr/local/Cellar/go/1.9/libexec/src/os/exec/internal_test.go
/usr/local/Cellar/go/1.9/libexec/src/strconv/internal_test.go
/usr/local/Cellar/go/1.9/libexec/src/time/internal_test.go
README.md
Outdated
@@ -15,39 +12,43 @@ This extension adds rich language support for the Go language to VS Code, includ | |||
- Quick Info (using `gogetdoc` or `godef`+`godoc`) | |||
- Goto Definition (using `gogetdoc` or `godef`+`godoc`) | |||
- Find References (using `guru`) | |||
- Find implementations (using `guru`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge from master, there are a lot of changes there
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm rebase from the master, seems not good rebase to an existing PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramya-rao-a Do you want me to re-create clean PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please, let's just do that. There is too much noise this PR.
Also add package suggestion when the directory name formed by multiple words, ex:
|
@uudashr I have rebased from master. Can you check if everything is as you expected? |
src/util.ts
Outdated
|
||
export function readDir(path): Promise<string[]> { | ||
return new Promise<string[]>((resolve, reject) => { | ||
fs.readdir(path, (err, files) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of getting all files under the path and then checking for main.go
, isn't it simpler to directly check for path + 'main.go'
using fs.statSync(filePath).isFile()
?
@uudashr Also updated to use |
@ramya-rao-a fs.stat() such a great idea |
@uudashr I also moved the whole pkg guessing logic to the utils file to make it re-usable as well as unit testable. When you have some time, can you add unit tests for that function? For all the cases that you have in the comments? |
Assume the directory name is
messaging
package main
*_test.go
=> suggestionpackage messaging_test
*internal_test.go
and rest of*.go
=> suggestionpackage messaging