loc

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package loc counts code/comment/blank lines. gocloc provides comment-aware counting; for languages with no gocloc mapping we fall back to "non-blank = code" and mark the result not comment-aware.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Counts

type Counts struct {
	Code         int
	Comment      int
	Blank        int
	CommentAware bool // false when no gocloc language mapping was available
}

Counts is the line breakdown for a file.

func Count

func Count(path, enryLang string, content []byte) Counts

Count returns the line breakdown for content. enryLang is the language ID from detection; it is mapped to a gocloc language for comment-aware counting. Unmapped languages fall back to non-blank=code with CommentAware=false.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL