Skip to content

golang - Code is not correctly formatted #6421

@firefart

Description

@firefart
Contributor

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

Activity

moved this to Needs Triage 🔍 in Kiotaon Apr 7, 2025
added theissue type on Apr 7, 2025
moved this from Needs Triage 🔍 to In Progress 🚧 in Kiotaon Apr 7, 2025
added
help wantedIssue caused by core project dependency modules or library
and removed on Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Gohelp wantedIssue caused by core project dependency modules or librarytype:bugA broken experience

Type

Projects

Status

In Progress 🚧

Milestone

No milestone

Relationships

None yet

    Development

    Participants

    @firefart@baywet

    Issue actions

      golang - Code is not correctly formatted · Issue #6421 · microsoft/kiota