sonar-go-to-slang

command module
v0.0.0-...-b3bb437 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: LGPL-3.0 Imports: 15 Imported by: 0

README

sonar-go-to-slang

Generate slang serialized AST in JSON from a go source file.

Building

To generate goparser_generated.go file in current directory, run:

go generate

To create sonar-go-to-slang executable in current directory, run:

go build

To create sonar-go-to-slang executable in $GOPATH/bin, run:

go install
Building on Windows

When trying to build sonar-go-to-slang on Windows, the build may fail with the following error:

 > Create symbolic link at [...]\slang\sonar-go-to-slang\.gogradle\project_gopath\src\github.com\SonarSource\slang\sonar-go-to-slang failed

Creating the symbolic link by hand solves this problem:

  • (Eventually enable developer mode in Windows)

  • Run (in sonar-go-to-slang folder):

    mklink /D ".gogradle\project_gopath\src\github.com\SonarSource\slang\sonar-go-to-slang" "Absolute\Path\To\slang\sonar-go-to-slang"

Running

If you have $GOPATH/bin on your PATH, it's easy to run with slang-generator-go.

Run with -h or -help or --help to get usage help.

Print the SLANG Json tree for some source.go:

sonar-go-to-slang source.go

Dump the native raw AST for some source.go:

sonar-go-to-slang -d source.go

Testing

To perform the tests, run:

go test

To update test results, use the method fix_all_go_files_test_automatically in goparser_test.go

Documentation

Overview

SonarQube Go Plugin Copyright (C) 2018-2024 SonarSource SA mailto:info AT sonarsource DOT com

This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Jump to

Keyboard shortcuts

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