Browse Source

Fix typos

pull/652/head
Xavier Petit 4 years ago
parent
commit
3660ebb699
No known key found for this signature in database
GPG Key ID: CA3F2B17E25ABD26
  1. 15
      go/tests/rc/README.md

15
go/tests/rc/README.md

@ -5,12 +5,14 @@ This program analyzes a go source file and displays in standard output the impor
### By default:
- Allowed
- All functions declared inside the source file are allowed
- Slices of all types are allowed
- Loops are allowed
- Relative imports are allowed
- Disallowed
- NO imports are allowed
- NO built-in functions are allowed.
- NO casting is allowed
@ -28,7 +30,7 @@ This program analyzes a go source file and displays in standard output the impor
### Arguments:
- Flags can be passed at any point (in the begginig, middle or end) of the argument list
- Flags can be passed at any point (in the beginning, middle or end) of the argument list
- The remaining arguments represent the allowed functions
- Allowed imports and functions from a package
@ -38,34 +40,38 @@ This program analyzes a go source file and displays in standard output the impor
- Ex: `fmt.*` (all functions from `fmt` are allowed), `github.com/01-edu/z01.PrintRune` (only `z01.PrintRune` is allowed), `fmt.Println#2` (fmt.Println can only be used 2 times or less)
- Allowed built-in functions
- Use the name of the built-in function
- It is posible to limit the number of calls of a functions like with the imports using the '#' character
- It is possible to limit the number of calls of a functions like with the imports using the '#' character
- Ex: `make`, `append`, `len`, `print#2`.
### Example:
- 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 written exactly the way they are written inside the source code, example:
```console
_$ rc main.go fmt.* github.com/01-edu/z01.PrintRune len
```
- Import "fmt" is allowed by executing
```console
_$ rc sourcefile.go fmt.*
```
- Import "go/parser" is allowed by executing
```console
_$ rc sourcefile.go go/parser.*
```
- Import "github.com/01-edu/z01" is allowed by executing
```console
_$ rc sourcefile.go github.com/01-edu/z01.*
```
- Disallow literals
- Use the flag `--no-lit="{PATTERN}"`
```console
_$ rc -no-slices --no-lit=[b-yB-Y] main.go fmt.* github.com/01-edu/z01.PrintRune len
@ -76,6 +82,7 @@ This program analyzes a go source file and displays in standard output the impor
```console
_$ rc -cast sourcefile.go fmt.* github.com/01-edu/z01 os.* strconv.* make len append
```
- this will allow all type of casting in the file sourcefile.go
- Disallow the use of the slices of type `string` and `int`
@ -89,6 +96,7 @@ This program analyzes a go source file and displays in standard output the impor
```console
_$ rc sourcefile.go fmt.* github.com/01-edu/z01 os.* strconv.* make len append rune
```
- this will allow the casting to `rune`, but not `int8`, ..., `string`, `float32`, ...
### How to read the error message
@ -123,6 +131,7 @@ Cheating:
```
The important part is printed after the `Cheating` tag:
- The import of of the package `fmt` is not allowed
- In go the dot (.) is also known as the access operator for that reason the use of fmt.Println is shown as an illegal-access
- Finally the main function is shown as illegal-definition because the function is using disallowed functions that does not mean that the function can not be defined it just mean that the definition of the function must be changed to not use disallowed functions.

Loading…
Cancel
Save