Skip to content

golang - Code is not correctly formatted #6421

@firefart

Description

@firefart

What are you generating using Kiota, clients or plugins?

API Client/SDK

In what context or format are you using Kiota?

Linux executable

Client library/SDK language

Go

Describe the bug

The current output of the golang generator is not formatted according to golangs style guide. This results in go fmt ./... touching those files after generation though it's not necessary (golang maintainers say, all generated code needs to be correctly formatted golang/go#73181 (comment)).

Expected behavior

There are several issues like newlines, extra parentheses, import ordering and so on

I created a PR over here #6416 trying to address those issues

How to reproduce

  1. Generate a client with the integration test as a base
rm -rf ./golangtest/
cp -r ./it/go golangtest
dotnet build
./src/kiota/bin/Debug/net9.0/kiota generate --openapi https://aka.ms/graph/v1.0/openapi.yaml --output ./golangtest/client --language go --exclude-backward-compatible --clean-output -i '/groups/getByIds#POST' -n 'integrationtest/client'
  1. Add a baseline to git
cd golangtest
git init
git add .
  1. Run go fmt and view the diff (the diff should be empty)
go fmt ./...
git diff

Open API description file

No response

Kiota Version

latest

Latest Kiota version known to work for scenario above?(Not required)

No response

Known Workarounds

No response

Configuration

No response

Debug output

No response

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

In Progress 🚧

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions