@ -6,10 +6,9 @@ This program analyses a go source file and displays in standard output the impor
- Allowed
- Allowed
- All functions declared inside the source file are allowed
- All functions declared inside the source file are allowed
- Slices of all types are allowed
- Array of all types are allowed
- Loops are allowed
- Loops are allowed
- Relative imports are allowed
- Relative imports are allowed
- Disallowed
- Disallowed
- NO imports are allowed
- NO imports are allowed
- NO built-in functions are allowed.
- NO built-in functions are allowed.
@ -22,13 +21,13 @@ This program analyses a go source file and displays in standard output the impor
- `-cast` allows casting to every built-in type.
- `-cast` allows casting to every built-in type.
- `-no-for` prohibits the use of `for` loops in the program or function.
- `-no-for` prohibits the use of `for` loops in the program or function.
- `-allow-builtin` allows all builtin functions and casting to builtin types
- `-allow-builtin` allows all builtin functions and casting to builtin types
- `-no-slices` disallows the use of all slices types
- `-no-arrays` disallows the use of all array types
- `-no-these-slices=type1,type2` : disallows the slice s of type1 and type2
- `-no-these-arrays=type1,type2` : disallows the array s of type1 and type2
- `-no-relative-imports` : disallows the use of relative imports
- `-no-relative-imports` : disallows the use of relative imports
### Arguments:
### Arguments:
- Flags must be passed first, before any other argument
- Flags must be passed passed first, before any other argument
- After the flags the first argument must be the file to be analysed
- After the flags the first argument must be the file to be analysed
@ -50,19 +49,19 @@ This program analyses a go source file and displays in standard output the impor
- Ex: `../piscine` , `..` , `.`
- Ex: `../piscine` , `..` , `.`
- Disallow `for` loops
- Disallow `for` loops
- Use the flags `-no-for` .
- Use the flags `-no-for` .
- Disallow all aslices types.
- Disallow all array types.
- Use `-no-slice s`
- Use `-no-array s`
- Unallow literals
- Unallow literals
- Use the flag `--no-lit="{PATTERN}"`
- Use the flag `--no-lit="{PATTERN}"`
- Note: `"{PATTERN}"` must be a valid Regular Expression.
- Note: `"{PATTERN}"` must be a valid Regular Expression.
- ex:
- ex:
```console
```console
_$ rc -no-slice s --no-lit=[b-yB-Y] main.go fmt.* github.com/01-edu/z01.PrintRune len
_$ rc -no-array s --no-lit=[b-yB-Y] main.go fmt.* github.com/01-edu/z01.PrintRune len
```
```
### Example:
### Example:
- To allow the import of the whole `fmt` package, `z01.PrintRune` and the built-in functions `len` for the file `main.go`
- To allow the import of the whole `fmt` package, `z01.PrintRune` and the built-in functions `len` for the file `main.go`
Note: The imports must be writen exactly the way they are writen inside the source code, example:
Note: The imports must be writen exactly the way they are writen inside the source code, example:
```console
```console
@ -94,7 +93,7 @@ This program analyses a go source file and displays in standard output the impor
- Disallow the use of the slices of type `string` and `int`
- Disallow the use of the slices of type `string` and `int`
```console
```console
_$ rc -no-these-slice s=string,int sourcefile.go
_$ rc -no-these-array s=string,int sourcefile.go
```
```
- To allow just one type of casting
- To allow just one type of casting