-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relates to #163
- Loading branch information
Showing
4 changed files
with
56 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ Aurken Bilbao <[email protected]> | |
Benny Daon <[email protected]> | ||
Daniele Sluijters <[email protected]> | ||
David Zhao <[email protected]> | ||
Kay <[email protected]> | ||
Luke S <[email protected]> | ||
Michiel De Backker <[email protected]> | ||
Sean DuBois <[email protected]> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"regexp" | ||
) | ||
|
||
func main() { | ||
parentDir, err := os.Getwd() | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
|
||
goRegex := regexp.MustCompile(`^[a-zA-Z][a-zA-Z0-9_]*\.go$`) | ||
|
||
err = filepath.Walk(parentDir, func(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if info.IsDir() { | ||
return nil | ||
} | ||
|
||
if filepath.Ext(path) != ".go" { | ||
return nil | ||
} | ||
|
||
filename := filepath.Base(path) | ||
|
||
if !goRegex.MatchString(filename) { | ||
return fmt.Errorf("%s is not a valid filename for Go code, only alpha, numbers and underscores are supported", filename) | ||
} | ||
|
||
return nil | ||
}) | ||
if err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} |