diff --git a/staticcheck/fakexml/marshal.go b/staticcheck/fakexml/marshal.go index 9c71e863..7c481e2c 100644 --- a/staticcheck/fakexml/marshal.go +++ b/staticcheck/fakexml/marshal.go @@ -340,7 +340,6 @@ func (e *Encoder) marshalStruct(tinfo *typeInfo, val fakereflect.TypeAndCanAddr, continue } } - continue case fComment: vf = indirect(vf) diff --git a/staticcheck/sa1026/testdata/go1.0/CheckUnsupportedMarshal/CheckUnsupportedMarshal.go b/staticcheck/sa1026/testdata/go1.0/CheckUnsupportedMarshal/CheckUnsupportedMarshal.go index 2ae94692..4d0cbb23 100644 --- a/staticcheck/sa1026/testdata/go1.0/CheckUnsupportedMarshal/CheckUnsupportedMarshal.go +++ b/staticcheck/sa1026/testdata/go1.0/CheckUnsupportedMarshal/CheckUnsupportedMarshal.go @@ -57,6 +57,14 @@ type Recursive struct { Field *Recursive } +type UnsupportedCharData struct { + Field chan int `xml:",chardata"` +} + +type UnsupportedCDATA struct { + Field func() `xml:",cdata"` +} + type ValueMarshaler chan int func (ValueMarshaler) MarshalText() ([]byte, error) { return nil, nil } @@ -316,6 +324,11 @@ func cyclicPointer() { xml.Marshal(s) //@ diag(`cyclic type P, via x.Foo.Bar`) } +func unsupportedTextFields() { + xml.Marshal(UnsupportedCharData{}) //@ diag(`unsupported type chan int`) + xml.Marshal(UnsupportedCDATA{}) //@ diag(`unsupported type func()`) +} + func functionAsArgument(arg T1) { // https://staticcheck.io/issues/1660