Skip to content

Conversation

ASH-WIN-10
Copy link

@ASH-WIN-10 ASH-WIN-10 commented Aug 16, 2025

Tokei was detecting a "/*" in a multiline string "``" as a comment in go.
This makes the rest of the code as a comment too resulting in wrong code and comment count.

Adding multiline string quotes "``" in the 'languages.json' file fixes this.

Example:

package main

import "fmt"

func main() {
    s := `/*`
    fmt.Println(s);
}

This resulted in the code count being only 4 lines and comments count being 2 even when there are no comments.

This is the output tokei gave before the change:
image

This is the output tokei gave after the change:
image

@ASH-WIN-10
Copy link
Author

also fixes the issue #1113

tokei was showing more code count because it considered the '"' in "``" as the start of the string.

Example:

package main

import "fmt"

func main() {
    s := `"`  // this would be considered as a the start of a string making the rest of the lines be considered as code even though there are some comments in it
    // comment
    //
    fmt.Println(s);
}
image

@ASH-WIN-10 ASH-WIN-10 changed the title Fix false comment being detected in multiline string in go Fix wrong estimation of code in go Aug 17, 2025
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.

1 participant