binaryexpr

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 21, 2020 License: MIT Imports: 5 Imported by: 0

README

binaryexpr

check *ast.BinaryExpr in golang code in according to number axis

Example of number axis(numbers from left to right):

-|---|---|---|---|---|--->
-2  -1   0   1   2   3

Invalid comparing:

if a >= 5 ....
if b > c ....
d := b > a
Valid comparing:

if 5 <= a ...
if c < b ...
d := a < b

Documentation

Overview

Example
package main

import (
	"fmt"
	"os"

	"github.com/Konstantin8105/binaryexpr"
)

func main() {
	err := binaryexpr.Test("./binaryexpr_test.go")
	fmt.Fprintf(os.Stdout, "%v", err)
}
Output:

./binaryexpr_test.go
├──./binaryexpr_test.go:13:5:	not acceprable operator: >=
├──./binaryexpr_test.go:16:8:	not acceprable operator: >=
└──./binaryexpr_test.go:16:20:	not acceprable operator: >

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Test

func Test(filename string) error

Test binary expression in file with filename and return error if used not acceptable binary expression `>=` or `>`.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL