Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add BindPlain #3904

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

add BindPlain #3904

wants to merge 2 commits into from

Conversation

guonaihong
Copy link
Contributor

#2037

package main

import (
	"github.com/gin-gonic/gin"
)

func main() {
	router := gin.Default()
	router.POST("/", func(c *gin.Context) {
		var s string
		c.BindPlain(&s)
		c.String(200, s)
	})

	router.Run()
}

// client
// curl -d "test string" 127.0.0.1:8080
// output
// test string

Copy link

codecov bot commented Mar 25, 2024

Codecov Report

Attention: Patch coverage is 90.32258% with 3 lines in your changes are missing coverage. Please review.

Project coverage is 99.12%. Comparing base (3dc1cd6) to head (5ede0c1).
Report is 31 commits behind head on master.

Files Patch % Lines
binding/plain.go 91.66% 2 Missing ⚠️
context.go 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3904      +/-   ##
==========================================
- Coverage   99.21%   99.12%   -0.10%     
==========================================
  Files          42       44       +2     
  Lines        3182     2739     -443     
==========================================
- Hits         3157     2715     -442     
+ Misses         17       14       -3     
- Partials        8       10       +2     
Flag Coverage Δ
?
-race ∅ <ø> (?)
-tags "sonic avx" 99.11% <90.32%> (?)
-tags go_json 99.11% <90.32%> (?)
-tags nomsgpack 99.10% <90.32%> (?)
go-1.18 99.05% <90.32%> (-0.07%) ⬇️
go-1.19 99.12% <90.32%> (-0.10%) ⬇️
go-1.20 99.12% <90.32%> (-0.10%) ⬇️
go-1.21 99.12% <90.32%> (-0.10%) ⬇️
go-1.22 99.12% <90.32%> (?)
macos-latest 99.12% <90.32%> (-0.10%) ⬇️
ubuntu-latest 99.12% <90.32%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@guonaihong
Copy link
Contributor Author

guonaihong commented Mar 26, 2024

It seems that running go test -tags "sonic avx" -v -covermode=count -coverprofile=profile.out will cause a panic. However, I couldn't reproduce this panic because my CPU doesn't support AVX 512 instructions

I've noticed several PRs with the same panic. It seems that the semantic differences between Sonic and the standard library might be causing this, or it could be a bug in Sonic.

@appleboy

@@ -614,7 +614,7 @@ func (c *Context) SaveUploadedFile(file *multipart.FileHeader, dst string) error
}
defer src.Close()

if err = os.MkdirAll(filepath.Dir(dst), 0750); err != nil {
if err = os.MkdirAll(filepath.Dir(dst), 0o750); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution should be exercised regarding permission modifications to files

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two lines of code are actually the same, except for the representation of file permissions using different formats for octal notation.

In the first line, the file permissions are represented using octal notation, specifically 0750. In octal notation, a number starting with 0 denotes that it's an octal number. Therefore, 0750 represents permissions set to rwxr-x--- (i.e., the owner has read, write, and execute permissions, the group users have read and execute permissions, and others have no permissions).

In the second line, the new octal literal notation is used, denoted by 0o750. In this notation, numbers start with 0o to indicate octal representation. So, 0o750 also represents permissions set to rwxr-x---.

In summary, these two lines of code are entirely equivalent; they just use different formats for representing permissions when using octal notation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants