Skip to content

Commit

Permalink
gofmt with Go 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
msoap committed Aug 7, 2022
1 parent f54434f commit c37b0e4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
3 changes: 2 additions & 1 deletion ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ type Func struct {
}

// getGolangFuncs - parse golang source file and get all functions
// funcs, err := getGolangFuncs(goFileContentInBytes)
//
// funcs, err := getGolangFuncs(goFileContentInBytes)
func getGolangFuncs(fileContent []byte) (result []Func, err error) {
fset := token.NewFileSet()
astFile, err := parser.ParseFile(fset, "", fileContent, 0)
Expand Down
19 changes: 9 additions & 10 deletions doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ Install/update:
Usage:
go-carpet [-options] [paths]
options:
-256colors - use more colors on 256-color terminal (indicate the level of coverage)
-args - pass additional arguments for go test (for example "-short" or "-i -timeout t")
-file string - comma-separated list of files to test (default: all)
-func string - comma-separated functions list (default: all functions)
-include-vendor - include vendor directories for show coverage (Godeps, vendor)
-summary - only show summary for each file
-version - get version
go-carpet [-options] [paths]
options:
-256colors - use more colors on 256-color terminal (indicate the level of coverage)
-args - pass additional arguments for go test (for example "-short" or "-i -timeout t")
-file string - comma-separated list of files to test (default: all)
-func string - comma-separated functions list (default: all functions)
-include-vendor - include vendor directories for show coverage (Godeps, vendor)
-summary - only show summary for each file
-version - get version
Source: https://github.com/msoap/go-carpet
*/
package main
5 changes: 3 additions & 2 deletions go-carpet.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,9 @@ func getColorHeader(header string, addUnderiline bool) string {
}

// algorithms from Go-sources:
// src/cmd/cover/html.go::percentCovered()
// src/testing/cover.go::coverReport()
//
// src/cmd/cover/html.go::percentCovered()
// src/testing/cover.go::coverReport()
func getStatForProfileBlocks(fileProfileBlocks []cover.ProfileBlock) (stat float64) {
var total, covered int64
for _, profileBlock := range fileProfileBlocks {
Expand Down
3 changes: 2 additions & 1 deletion go-carpet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ func assertDontPanic(t *testing.T, fn func(), name string) {
}

// usage:
// defer testChdir(t, "/path")()
//
// defer testChdir(t, "/path")()
func testChdir(t *testing.T, dir string) func() {
cwd, err := os.Getwd()
if err != nil {
Expand Down

0 comments on commit c37b0e4

Please sign in to comment.