Skip to content

Commit

Permalink
languages: copy over latest version from sourcegraph
Browse files Browse the repository at this point in the history
I realised we haven't been updating this package as we updated the
package in the sourcegraph repo.

We don't need all the functionality it has, but its easier to just copy
paste everything.

Test Plan: go test
  • Loading branch information
keegancsmith committed Sep 17, 2024
1 parent be438ef commit 78a7ea4
Show file tree
Hide file tree
Showing 10 changed files with 908 additions and 182 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ require (
golang.org/x/sys v0.25.0
google.golang.org/grpc v1.66.1
google.golang.org/protobuf v1.34.2
pgregory.net/rapid v1.1.0
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,6 @@ honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ=
pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
15 changes: 15 additions & 0 deletions internal/languages/enry_vendored.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package languages

import "strings"

// This file contains functions private functions
// vendored from the go-enry codebase.

// convertToAliasKey is vendored from go-enry to make sure
// we're normalizing strings the same way.
func convertToAliasKey(langName string) string {
ak := strings.SplitN(langName, `,`, 2)[0]
ak = strings.Replace(ak, ` `, `_`, -1)
ak = strings.ToLower(ak)
return ak
}
Loading

0 comments on commit 78a7ea4

Please sign in to comment.