Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Provide centralized Go package which handles language detection, file extension mappings etc. #56379

@varungandhi-src

Description

@varungandhi-src

One potential approach:

  • Create a wrapper package for go-enry which only allows "safe" APIs (i.e. doesn't forward APIs like GetLanguageByExtension and similar which arbitrarily return a language + a boolean value determining if there is ambiguity or not).
  • Change all existing usages of go-enry to go through the new package.
  • Add a lint preventing direct usage of go-enry outside the wrapper package.

Example place relying on ad-hoc listing of file mappings per language: https://sourcegraph.com/github.com/sourcegraph/sourcegraph/-/blob/internal/codeintel/uploads/shared/indexers2.go?L79-93

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions