Giter Club home page Giter Club logo

Comments (3)

bhcleek avatar bhcleek commented on June 2, 2024

The syntax in your example is invalid. The comma after the cursor is unnecessary, because you're dealing with the empty struct and there are no fields to separate. Also, there is no comma after the final element's } and just before the newline after which follows the slice's closing }.

I assume that the example you provided is not quite what you're seeing in practice. If you can provide an example that's syntactically correct, we may be able to discover the root of the problem you're having.

from vim-go.

onns avatar onns commented on June 2, 2024
package main

import "fmt"

type Foo struct {
	S string `json:"s"`
	N int64  `json:"n"`
}

func main() {
	fs := []*Foo{
		{
			// cursor here does not work
		},
	}
	fs := []Foo{
		{
                        // cursor here work well.
			S: "",
			N: 0,
		},
	}
}

sorry for the bad example, I thought it wouldn't work while handling struct slice so I write a simple example, but after I tested, only []*struct has the problem.

from vim-go.

bhcleek avatar bhcleek commented on June 2, 2024

If you'll change change the fillstruct mode with let g:go_fillstruct_mode='gopls', I think the case slice of pointers case will work, too.

If you want to continue to use fillstruct for g:go_fillstruct_mode, then I'd suggest opening an issue at https://github.com/davidrjenni/reftools.

from vim-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.