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

error: processInner: not implemented for type: *ast.SliceExpr #12

Closed
martin-sucha opened this issue Sep 11, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@martin-sucha
Copy link

Hello, code like this causes an error in the linter:

func marshal(val *pb.MyValue) ([]byte, error) {
	data := make([]byte, 4+val.SizeVT())
	binary.BigEndian.PutUint32(data[0:4], 1234)
	n, err := val.MarshalToVT(data[4:])
	if err != nil {
		return nil, err
	}
	return data[:4+n], nil
}

The issue is with the data[4:] parameter to MarshalToVT. It seems that the regular methods that proto compiler generates don't take parameters, so it only affects methods generated by other tools.

Note: the MarshalToVT is generated by vtprotobuf

Is the correct fix to add *ast.SliceExpr to the list of AST nodes that are just formatted?

@ghostiam ghostiam self-assigned this Sep 11, 2024
@ghostiam ghostiam added the bug Something isn't working label Sep 11, 2024
@ghostiam
Copy link
Owner

ghostiam commented Sep 11, 2024

Hello, thanks for the issue.
I checked, yes, it was just necessary to add ast.SliceExpr handling.
Please check the new version:
https://github.com/ghostiam/protogetter/releases/tag/v0.3.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants