-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix_golangcilint_empty_result_error (#4)
* fix_golangcilint_empty_result_error * fix_golangcilint_empty_result_error * fix_golangcilint_empty_result_error * fix_golangcilint_empty_result_error
- Loading branch information
1 parent
06e093d
commit 15833e5
Showing
7 changed files
with
82 additions
and
64 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
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 |
---|---|---|
@@ -1,34 +1,21 @@ | ||
package cgoexample | ||
package mymodule | ||
|
||
/* | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
import "fmt" | ||
|
||
void myprint(char* s) { | ||
printf("%s\n", s); | ||
} | ||
*/ | ||
import "C" | ||
func MyModule() { | ||
|
||
import ( | ||
"fmt" | ||
"unsafe" | ||
) | ||
var u1 = "initial" | ||
var u2 = "initial" | ||
|
||
func Example() { | ||
cs := C.CString("Hello from stdio\n") | ||
C.myprint(cs) | ||
fmt.Printf("bad format %t", cs) | ||
C.free(unsafe.Pointer(cs)) | ||
} | ||
var b, c int = 1, 2 | ||
fmt.Println(b, c) | ||
|
||
func notFormattedForGofmt() { | ||
} | ||
var d = true | ||
fmt.Println(d) | ||
|
||
func errorForRevive(p *int) error { | ||
if p == nil { | ||
return nil | ||
} else { | ||
return nil | ||
} | ||
var e int | ||
fmt.Println(e) | ||
|
||
f := "apple" | ||
fmt.Println(f) | ||
} |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module mymodule | ||
module hello | ||
|
||
go 1.23.0 | ||
go 1.22.0 |
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,7 @@ | ||
package hello | ||
|
||
func Hello() string { | ||
var u3 = "initial" | ||
var u4 = "initial" | ||
return "Hello, world." | ||
} |
21 changes: 21 additions & 0 deletions
21
code-issue-examples/go/module-with-mod/mymodule/unused-var.go
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,21 @@ | ||
package mymodule | ||
|
||
import "fmt" | ||
|
||
func MyModule() { | ||
|
||
var u1 = "initial" | ||
var u2 = "initial" | ||
|
||
var b, c int = 1, 2 | ||
fmt.Println(b, c) | ||
|
||
var d = true | ||
fmt.Println(d) | ||
|
||
var e int | ||
fmt.Println(e) | ||
|
||
f := "apple" | ||
fmt.Println(f) | ||
} |
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